diff options
author | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 22:12:33 +0000 |
---|---|---|
committer | alokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 22:12:33 +0000 |
commit | 973b7701f2be80ea89cc0799912b64b76a30de5d (patch) | |
tree | 2a6e7f587d9e94e26d8a30d56491f2a9fb4621db /skia | |
parent | 00174ef7842eef55f7d697fedf947b5ad415368c (diff) | |
download | chromium_src-973b7701f2be80ea89cc0799912b64b76a30de5d.zip chromium_src-973b7701f2be80ea89cc0799912b64b76a30de5d.tar.gz chromium_src-973b7701f2be80ea89cc0799912b64b76a30de5d.tar.bz2 |
Fixed a few styles issues in skia::PlatformDevice. Made function names consistent. Added Begin/EndPlatformPaint on Mac.
Review URL: http://codereview.chromium.org/6691067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.cc | 2 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_linux.h | 2 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 6 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.h | 2 | ||||
-rw-r--r-- | skia/ext/canvas_paint_linux.h | 2 | ||||
-rw-r--r-- | skia/ext/platform_canvas_linux.cc | 4 | ||||
-rw-r--r-- | skia/ext/platform_canvas_mac.cc | 4 | ||||
-rw-r--r-- | skia/ext/platform_canvas_win.cc | 6 | ||||
-rw-r--r-- | skia/ext/platform_device_linux.cc | 6 | ||||
-rw-r--r-- | skia/ext/platform_device_linux.h | 3 | ||||
-rw-r--r-- | skia/ext/platform_device_mac.cc | 8 | ||||
-rw-r--r-- | skia/ext/platform_device_mac.h | 3 | ||||
-rw-r--r-- | skia/ext/platform_device_win.cc | 5 | ||||
-rw-r--r-- | skia/ext/platform_device_win.h | 4 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_cairo_linux.cc | 2 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_cairo_linux.h | 2 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_emf_win.cc | 15 | ||||
-rw-r--r-- | skia/ext/vector_platform_device_emf_win.h | 4 |
18 files changed, 50 insertions, 30 deletions
diff --git a/skia/ext/bitmap_platform_device_linux.cc b/skia/ext/bitmap_platform_device_linux.cc index dab2122..e4653fc 100644 --- a/skia/ext/bitmap_platform_device_linux.cc +++ b/skia/ext/bitmap_platform_device_linux.cc @@ -151,7 +151,7 @@ bool BitmapPlatformDevice::IsVectorial() { return false; } -cairo_t* BitmapPlatformDevice::beginPlatformPaint() { +cairo_t* BitmapPlatformDevice::BeginPlatformPaint() { data_->LoadConfig(); cairo_t* cairo = data_->bitmap_context(); cairo_surface_t* surface = cairo_get_target(cairo); diff --git a/skia/ext/bitmap_platform_device_linux.h b/skia/ext/bitmap_platform_device_linux.h index 090a13d..e01acd6 100644 --- a/skia/ext/bitmap_platform_device_linux.h +++ b/skia/ext/bitmap_platform_device_linux.h @@ -97,7 +97,7 @@ class BitmapPlatformDevice : public PlatformDevice { // Overridden from PlatformDevice: virtual bool IsVectorial(); - virtual cairo_t* beginPlatformPaint(); + virtual cairo_t* BeginPlatformPaint(); private: static BitmapPlatformDevice* Create(int width, int height, bool is_opaque, diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 75eb113..618f3db 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -201,7 +201,7 @@ BitmapPlatformDevice& BitmapPlatformDevice::operator=( return *this; } -HDC BitmapPlatformDevice::beginPlatformPaint() { +HDC BitmapPlatformDevice::BeginPlatformPaint() { return data_->GetBitmapDC(); } @@ -214,7 +214,7 @@ void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, const RECT* src_rect) { bool created_dc = !data_->IsBitmapDCCreated(); - HDC source_dc = beginPlatformPaint(); + HDC source_dc = BeginPlatformPaint(); RECT temp_rect; if (!src_rect) { @@ -261,7 +261,7 @@ void BitmapPlatformDevice::drawToHDC(HDC dc, int x, int y, } LoadTransformToDC(source_dc, data_->transform()); - endPlatformPaint(); + EndPlatformPaint(); if (created_dc) data_->ReleaseBitmapDC(); } diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index 6d5805f..2d18449 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h @@ -75,7 +75,7 @@ class BitmapPlatformDevice : public PlatformDevice { // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The // bitmap DC is lazy created. - virtual HDC beginPlatformPaint(); + virtual PlatformSurface BeginPlatformPaint(); // Loads the given transform and clipping region into the HDC. This is // overridden from SkDevice. diff --git a/skia/ext/canvas_paint_linux.h b/skia/ext/canvas_paint_linux.h index 6aaae79..73d9617 100644 --- a/skia/ext/canvas_paint_linux.h +++ b/skia/ext/canvas_paint_linux.h @@ -92,7 +92,7 @@ class CanvasPaintT : public T { // surface. T::translate(-SkIntToScalar(bounds.x), -SkIntToScalar(bounds.y)); - context_ = T::getTopPlatformDevice().beginPlatformPaint(); + context_ = T::getTopPlatformDevice().BeginPlatformPaint(); } cairo_t* context_; diff --git a/skia/ext/platform_canvas_linux.cc b/skia/ext/platform_canvas_linux.cc index fc038f9..1de283c 100644 --- a/skia/ext/platform_canvas_linux.cc +++ b/skia/ext/platform_canvas_linux.cc @@ -34,11 +34,11 @@ bool PlatformCanvas::initialize(int width, int height, bool is_opaque, } cairo_t* PlatformCanvas::beginPlatformPaint() const { - return getTopPlatformDevice().beginPlatformPaint(); + return getTopPlatformDevice().BeginPlatformPaint(); } void PlatformCanvas::endPlatformPaint() const { - // We don't need to do anything on Linux here. + getTopPlatformDevice().EndPlatformPaint(); } } // namespace skia diff --git a/skia/ext/platform_canvas_mac.cc b/skia/ext/platform_canvas_mac.cc index e79e087..64603a8 100644 --- a/skia/ext/platform_canvas_mac.cc +++ b/skia/ext/platform_canvas_mac.cc @@ -50,11 +50,11 @@ bool PlatformCanvas::initialize(CGContextRef context, } CGContextRef PlatformCanvas::beginPlatformPaint() const { - return getTopPlatformDevice().GetBitmapContext(); + return getTopPlatformDevice().BeginPlatformPaint(); } void PlatformCanvas::endPlatformPaint() const { - // Flushing will be done in onAccessBitmap. + getTopPlatformDevice().EndPlatformPaint(); } } // namespace skia diff --git a/skia/ext/platform_canvas_win.cc b/skia/ext/platform_canvas_win.cc index 8d1a65a4..2283b19 100644 --- a/skia/ext/platform_canvas_win.cc +++ b/skia/ext/platform_canvas_win.cc @@ -107,13 +107,11 @@ bool PlatformCanvas::initialize(int width, } HDC PlatformCanvas::beginPlatformPaint() const { - return getTopPlatformDevice().beginPlatformPaint(); + return getTopPlatformDevice().BeginPlatformPaint(); } void PlatformCanvas::endPlatformPaint() const { - // we don't clear the DC here since it will be likely to be used again - // flushing will be done in onAccessBitmap - return getTopPlatformDevice().endPlatformPaint(); + return getTopPlatformDevice().EndPlatformPaint(); } } // namespace skia diff --git a/skia/ext/platform_device_linux.cc b/skia/ext/platform_device_linux.cc index c8ea48e..b943120 100644 --- a/skia/ext/platform_device_linux.cc +++ b/skia/ext/platform_device_linux.cc @@ -11,7 +11,11 @@ PlatformDevice::PlatformDevice(const SkBitmap& bitmap) } bool PlatformDevice::IsNativeFontRenderingAllowed() { - return true; + return true; +} + +void PlatformDevice::EndPlatformPaint() { + // We don't need to do anything on Linux here. } } // namespace skia diff --git a/skia/ext/platform_device_linux.h b/skia/ext/platform_device_linux.h index e40934b..718560c 100644 --- a/skia/ext/platform_device_linux.h +++ b/skia/ext/platform_device_linux.h @@ -23,7 +23,8 @@ class PlatformDevice : public SkDevice { // Returns if native platform APIs are allowed to render text to this device. virtual bool IsNativeFontRenderingAllowed(); - virtual PlatformSurface beginPlatformPaint() = 0; + virtual PlatformSurface BeginPlatformPaint() = 0; + virtual void EndPlatformPaint(); protected: // Forwards |bitmap| to SkDevice's constructor. diff --git a/skia/ext/platform_device_mac.cc b/skia/ext/platform_device_mac.cc index 30a179a..e18c402 100644 --- a/skia/ext/platform_device_mac.cc +++ b/skia/ext/platform_device_mac.cc @@ -40,6 +40,14 @@ bool PlatformDevice::IsNativeFontRenderingAllowed() { return true; } +CGContextRef PlatformDevice::BeginPlatformPaint() { + return GetBitmapContext(); +} + +void PlatformDevice::EndPlatformPaint() { + // Flushing will be done in onAccessBitmap. +} + // Set up the CGContextRef for peaceful coexistence with Skia void PlatformDevice::InitializeCGContext(CGContextRef context) { // CG defaults to the same settings as Skia diff --git a/skia/ext/platform_device_mac.h b/skia/ext/platform_device_mac.h index d3ad829..6ce6ddd 100644 --- a/skia/ext/platform_device_mac.h +++ b/skia/ext/platform_device_mac.h @@ -44,6 +44,9 @@ class PlatformDevice : public SkDevice { // Returns if native platform APIs are allowed to render text to this device. virtual bool IsNativeFontRenderingAllowed(); + virtual PlatformSurface BeginPlatformPaint(); + virtual void EndPlatformPaint(); + // Initializes the default settings and colors in a device context. static void InitializeCGContext(CGContextRef context); diff --git a/skia/ext/platform_device_win.cc b/skia/ext/platform_device_win.cc index 039de33..dd79ab3 100644 --- a/skia/ext/platform_device_win.cc +++ b/skia/ext/platform_device_win.cc @@ -16,6 +16,11 @@ PlatformDevice::PlatformDevice(const SkBitmap& bitmap) : SkDevice(NULL, bitmap, /*isForLayer=*/false) { } +void PlatformDevice::EndPlatformPaint() { + // We don't clear the DC here since it will be likely to be used again. + // Flushing will be done in onAccessBitmap. +} + // static void PlatformDevice::InitializeDC(HDC context) { // Enables world transformation. diff --git a/skia/ext/platform_device_win.h b/skia/ext/platform_device_win.h index 966b49f..5523ef9 100644 --- a/skia/ext/platform_device_win.h +++ b/skia/ext/platform_device_win.h @@ -30,10 +30,10 @@ class SK_API PlatformDevice : public SkDevice { // The DC that corresponds to the bitmap, used for GDI operations drawing // into the bitmap. This is possibly heavyweight, so it should be existant // only during one pass of rendering. - virtual HDC beginPlatformPaint() = 0; + virtual PlatformSurface BeginPlatformPaint() = 0; // Finish a previous call to beginPlatformPaint. - virtual void endPlatformPaint() { } + virtual void EndPlatformPaint(); // Draws to the given screen DC, if the bitmap DC doesn't exist, this will // temporarily create it. However, if you have created the bitmap DC, it will diff --git a/skia/ext/vector_platform_device_cairo_linux.cc b/skia/ext/vector_platform_device_cairo_linux.cc index ba79a2b..defd904 100644 --- a/skia/ext/vector_platform_device_cairo_linux.cc +++ b/skia/ext/vector_platform_device_cairo_linux.cc @@ -138,7 +138,7 @@ bool VectorPlatformDeviceCairo::IsVectorial() { } PlatformDevice::PlatformSurface -VectorPlatformDeviceCairo::beginPlatformPaint() { +VectorPlatformDeviceCairo::BeginPlatformPaint() { return context_; } diff --git a/skia/ext/vector_platform_device_cairo_linux.h b/skia/ext/vector_platform_device_cairo_linux.h index 29c4b95..64628ab 100644 --- a/skia/ext/vector_platform_device_cairo_linux.h +++ b/skia/ext/vector_platform_device_cairo_linux.h @@ -82,7 +82,7 @@ class VectorPlatformDeviceCairo : public PlatformDevice { virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, const SkClipStack&); - virtual PlatformSurface beginPlatformPaint(); + virtual PlatformSurface BeginPlatformPaint(); virtual bool IsVectorial(); protected: diff --git a/skia/ext/vector_platform_device_emf_win.cc b/skia/ext/vector_platform_device_emf_win.cc index 07d1083..621ba32 100644 --- a/skia/ext/vector_platform_device_emf_win.cc +++ b/skia/ext/vector_platform_device_emf_win.cc @@ -115,6 +115,9 @@ VectorPlatformDeviceEmf::~VectorPlatformDeviceEmf() { SkASSERT(previous_pen_ == NULL); } +HDC VectorPlatformDeviceEmf::BeginPlatformPaint() { + return hdc_; +} void VectorPlatformDeviceEmf::drawPaint(const SkDraw& draw, const SkPaint& paint) { @@ -194,14 +197,14 @@ void VectorPlatformDeviceEmf::drawRect(const SkDraw& draw, if (!ApplyPaint(paint)) { return; } - HDC dc = beginPlatformPaint(); + HDC dc = BeginPlatformPaint(); if (!Rectangle(dc, SkScalarRound(rect.fLeft), SkScalarRound(rect.fTop), SkScalarRound(rect.fRight), SkScalarRound(rect.fBottom))) { SkASSERT(false); } - endPlatformPaint(); + EndPlatformPaint(); Cleanup(); } @@ -227,7 +230,7 @@ void VectorPlatformDeviceEmf::drawPath(const SkDraw& draw, if (!ApplyPaint(paint)) { return; } - HDC dc = beginPlatformPaint(); + HDC dc = BeginPlatformPaint(); PlatformDevice::LoadPathToDC(dc, path); switch (paint.getStyle()) { case SkPaint::kFill_Style: { @@ -249,7 +252,7 @@ void VectorPlatformDeviceEmf::drawPath(const SkDraw& draw, SkASSERT(false); break; } - endPlatformPaint(); + EndPlatformPaint(); Cleanup(); } @@ -656,7 +659,7 @@ void VectorPlatformDeviceEmf::InternalDrawBitmap(const SkBitmap& bitmap, } } - HDC dc = beginPlatformPaint(); + HDC dc = BeginPlatformPaint(); BITMAPINFOHEADER hdr; FillBitmapInfoHeader(src_size_x, src_size_y, &hdr); if (is_translucent) { @@ -722,7 +725,7 @@ void VectorPlatformDeviceEmf::InternalDrawBitmap(const SkBitmap& bitmap, SRCCOPY); SkASSERT(result); } - endPlatformPaint(); + EndPlatformPaint(); Cleanup(); } diff --git a/skia/ext/vector_platform_device_emf_win.h b/skia/ext/vector_platform_device_emf_win.h index d86e1db..9091792a 100644 --- a/skia/ext/vector_platform_device_emf_win.h +++ b/skia/ext/vector_platform_device_emf_win.h @@ -39,9 +39,7 @@ class VectorPlatformDeviceEmf : public PlatformDevice { return SkNEW(VectorPlatformDeviceEmfFactory); } - virtual HDC beginPlatformPaint() { - return hdc_; - } + virtual PlatformSurface BeginPlatformPaint(); virtual void drawPaint(const SkDraw& draw, const SkPaint& paint) OVERRIDE; virtual void drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |