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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 354133002: change gpudevice and pdfdevice to inherit from basedevice (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d34170cba110160aa42446bbfaa9d319c965923b..93224d3e403340f2cba7f8cdd59dc9d082e236bc 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -149,13 +149,11 @@ SkGpuDevice* SkGpuDevice::Create(GrSurface* surface, unsigned flags) {
}
}
-SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture, unsigned flags)
- : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
+SkGpuDevice::SkGpuDevice(GrContext* context, GrTexture* texture, unsigned flags) {
this->initFromRenderTarget(context, texture->asRenderTarget(), flags);
}
-SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget, unsigned flags)
- : SkBitmapDevice(make_bitmap(context, renderTarget)) {
+SkGpuDevice::SkGpuDevice(GrContext* context, GrRenderTarget* renderTarget, unsigned flags) {
this->initFromRenderTarget(context, renderTarget, flags);
}
@@ -185,8 +183,8 @@ void SkGpuDevice::initFromRenderTarget(GrContext* context,
SkPixelRef* pr = SkNEW_ARGS(SkGrPixelRef,
(surface->info(), surface, SkToBool(flags & kCached_Flag)));
-
- this->setPixelRef(pr)->unref();
+ fLegacyBitmap.setInfo(surface->info());
+ fLegacyBitmap.setPixelRef(pr)->unref();
bool useDFFonts = !!(flags & kDFFonts_Flag);
fMainTextContext = fContext->createTextContext(fRenderTarget, fLeakyProperties, useDFFonts);
@@ -290,14 +288,14 @@ bool SkGpuDevice::onWritePixels(const SkImageInfo& info, const void* pixels, siz
fRenderTarget->writePixels(x, y, info.width(), info.height(), config, pixels, rowBytes, flags);
// need to bump our genID for compatibility with clients that "know" we have a bitmap
- this->onAccessBitmap().notifyPixelsChanged();
+ fLegacyBitmap.notifyPixelsChanged();
return true;
}
const SkBitmap& SkGpuDevice::onAccessBitmap() {
DO_DEFERRED_CLEAR();
- return INHERITED::onAccessBitmap();
+ return fLegacyBitmap;
}
void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {

Powered by Google App Engine
This is Rietveld 408576698