diff options
Diffstat (limited to 'skia')
-rw-r--r-- | skia/ext/bitmap_platform_device_win.cc | 9 | ||||
-rw-r--r-- | skia/ext/bitmap_platform_device_win.h | 13 |
2 files changed, 18 insertions, 4 deletions
diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc index 5c0bd61..5678b9b 100644 --- a/skia/ext/bitmap_platform_device_win.cc +++ b/skia/ext/bitmap_platform_device_win.cc @@ -177,6 +177,7 @@ BitmapPlatformDevice::BitmapPlatformDevice( : PlatformDevice(bitmap), data_(data) { // The data object is already ref'ed for us by create(). + SkDEBUGCODE(begin_paint_count_ = 0); } // The copy constructor just adds another reference to the underlying data. @@ -188,9 +189,11 @@ BitmapPlatformDevice::BitmapPlatformDevice( const_cast<BitmapPlatformDevice&>(other).accessBitmap(true)), data_(other.data_) { data_->ref(); + SkDEBUGCODE(begin_paint_count_ = 0); } BitmapPlatformDevice::~BitmapPlatformDevice() { + SkASSERT(begin_paint_count_ == 0); data_->unref(); } @@ -202,9 +205,15 @@ BitmapPlatformDevice& BitmapPlatformDevice::operator=( } HDC BitmapPlatformDevice::BeginPlatformPaint() { + SkDEBUGCODE(begin_paint_count_++); return data_->GetBitmapDC(); } +void BitmapPlatformDevice::EndPlatformPaint() { + SkASSERT(begin_paint_count_--); + PlatformDevice::EndPlatformPaint(); +} + void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform, const SkRegion& region, const SkClipStack&) { diff --git a/skia/ext/bitmap_platform_device_win.h b/skia/ext/bitmap_platform_device_win.h index 485c532..7f901f5 100644 --- a/skia/ext/bitmap_platform_device_win.h +++ b/skia/ext/bitmap_platform_device_win.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ -#define SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ +#ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ +#define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ #pragma once #include "skia/ext/platform_device_win.h" @@ -12,7 +12,7 @@ namespace skia { class BitmapPlatformDeviceFactory : public SkDeviceFactory { public: - virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, + virtual SkDevice* newDevice(SkCanvas* ignored, SkBitmap::Config config, int width, int height, bool isOpaque, bool isForLayer); }; @@ -72,6 +72,7 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { // Retrieves the bitmap DC, which is the memory DC for our bitmap data. The // bitmap DC is lazy created. virtual PlatformSurface BeginPlatformPaint(); + virtual void EndPlatformPaint(); // Loads the given transform and clipping region into the HDC. This is // overridden from SkDevice. @@ -108,9 +109,13 @@ class SK_API BitmapPlatformDevice : public PlatformDevice { // Data associated with this device, guaranteed non-null. We hold a reference // to this object. BitmapPlatformDeviceData* data_; + +#ifdef SK_DEBUG + int begin_paint_count_; +#endif }; } // namespace skia -#endif // SKIA_BITMAP_PLATFORM_DEVICE_WIN_H_ +#endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |