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

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: pdfdevice needs to override newSurface 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
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d34170cba110160aa42446bbfaa9d319c965923b..3b82a33c9c542dfd95cfd235b6559db788deb5aa 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -127,16 +127,6 @@ public:
///////////////////////////////////////////////////////////////////////////////
-/*
- * GrRenderTarget does not know its opaqueness, only its config, so we have
- * to make conservative guesses when we return an "equivalent" bitmap.
- */
-static SkBitmap make_bitmap(GrContext* context, GrRenderTarget* renderTarget) {
- SkBitmap bitmap;
- bitmap.setInfo(renderTarget->info());
- return bitmap;
-}
-
SkGpuDevice* SkGpuDevice::Create(GrSurface* surface, unsigned flags) {
SkASSERT(NULL != surface);
if (NULL == surface->asRenderTarget() || NULL == surface->getContext()) {
@@ -149,13 +139,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 +173,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 +278,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) {
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698