Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(858)

Unified Diff: skia/ext/bitmap_platform_device_win.cc

Issue 7633040: CL removing inheritance of SkDevice from PlatformDevice. Flavours of PlatformDevice classes now ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix use of drawSprite. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: skia/ext/bitmap_platform_device_win.cc
===================================================================
--- skia/ext/bitmap_platform_device_win.cc (revision 96545)
+++ skia/ext/bitmap_platform_device_win.cc (working copy)
@@ -88,7 +88,7 @@
// that we can create the pixel data before calling the constructor. This is
// required so that we can call the base class' constructor with the pixel
// data.
-BitmapPlatformDevice* BitmapPlatformDevice::create(
+SkDevice* BitmapPlatformDevice::create(
HDC screen_dc,
int width,
int height,
@@ -142,20 +142,27 @@
}
}
+ SkDevice* new_device = new SkDevice(bitmap);
// The device object will take ownership of the HBITMAP. The initial refcount
// of the data object will be 1, which is what the constructor expects.
- return new BitmapPlatformDevice(new BitmapPlatformDeviceData(hbitmap),
- bitmap);
+ BitmapPlatformDevice* bitmap_platform_device =
+ new BitmapPlatformDevice(new BitmapPlatformDeviceData(hbitmap),
+ new_device);
+ return new_device;
}
// static
-BitmapPlatformDevice* BitmapPlatformDevice::create(int width,
- int height,
- bool is_opaque,
- HANDLE shared_section) {
+SkDevice* BitmapPlatformDevice::create(int width,
+ int height,
+ bool is_opaque,
+ HANDLE shared_section) {
HDC screen_dc = GetDC(NULL);
+#if 0
BitmapPlatformDevice* device = BitmapPlatformDevice::create(
screen_dc, width, height, is_opaque, shared_section);
+#endif
+ SkDevice* device = BitmapPlatformDevice::create(screen_dc, width, height,
+ is_opaque, shared_section);
ReleaseDC(NULL, screen_dc);
return device;
}
@@ -164,11 +171,15 @@
// data. Therefore, we do not transfer ownership to the SkDevice's bitmap.
BitmapPlatformDevice::BitmapPlatformDevice(
BitmapPlatformDeviceData* data,
- const SkBitmap& bitmap)
- : PlatformDevice(bitmap),
+ SkDevice* device
+ /*const SkBitmap& bitmap*/)
+ : /*PlatformDevice(bitmap),*/
+ PlatformDevice(device),
data_(data) {
// The data object is already ref'ed for us by create().
SkDEBUGCODE(begin_paint_count_ = 0);
+
+ GetOwningDevice()->setMatrixClipObserver(this);
}
BitmapPlatformDevice::~BitmapPlatformDevice() {
@@ -183,14 +194,24 @@
void BitmapPlatformDevice::EndPlatformPaint() {
SkASSERT(begin_paint_count_--);
+ if (data_->IsBitmapDCCreated())
+ GdiFlush();
PlatformDevice::EndPlatformPaint();
}
+void BitmapPlatformDevice::matrixClipChanged(const SkMatrix& transform,
+ const SkRegion& region,
+ const SkClipStack&) {
+ data_->SetMatrixClip(transform, region);
+}
+
+#if 0
void BitmapPlatformDevice::setMatrixClip(const SkMatrix& transform,
const SkRegion& region,
const SkClipStack&) {
data_->SetMatrixClip(transform, region);
}
+#endif
void BitmapPlatformDevice::DrawToNativeContext(HDC dc, int x, int y,
const RECT* src_rect) {
@@ -200,9 +221,9 @@
RECT temp_rect;
if (!src_rect) {
temp_rect.left = 0;
- temp_rect.right = width();
+ temp_rect.right = GetOwningDevice()->width();
temp_rect.top = 0;
- temp_rect.bottom = height();
+ temp_rect.bottom = GetOwningDevice()->height();
src_rect = &temp_rect;
}
@@ -215,7 +236,7 @@
identity.reset();
LoadTransformToDC(source_dc, identity);
- if (isOpaque()) {
+ if (GetOwningDevice()->isOpaque()) {
BitBlt(dc,
x,
y,
@@ -247,19 +268,23 @@
data_->ReleaseBitmapDC();
}
+#if 0
void BitmapPlatformDevice::onAccessBitmap(SkBitmap* bitmap) {
// FIXME(brettw) OPTIMIZATION: We should only flush if we know a GDI
// operation has occurred on our DC.
if (data_->IsBitmapDCCreated())
GdiFlush();
}
+#endif
+#if 0
SkDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
SkBitmap::Config config, int width, int height, bool isOpaque,
Usage /*usage*/) {
SkASSERT(config == SkBitmap::kARGB_8888_Config);
return BitmapPlatformDevice::create(width, height, isOpaque, NULL);
}
+#endif
} // namespace skia

Powered by Google App Engine
This is Rietveld 408576698