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

Unified Diff: src/gpu/SkGpuDevice.cpp

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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: src/gpu/SkGpuDevice.cpp
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 040833b731d22c359289807e4f9374971425430c..258355e497fe219adfeddeb69a593f29052db0ed 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -122,10 +122,22 @@ sk_sp<SkGpuDevice> SkGpuDevice::Make(GrContext* context, SkBudgeted budgeted,
info.width(), info.height(), flags));
}
-SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height, unsigned flags)
- : INHERITED(drawContext->surfaceProps())
+static SkImageInfo make_info(GrDrawContext* context, int w, int h, bool opaque) {
+ SkColorType colorType;
+ if (!GrPixelConfigToColorType(context->config(), &colorType)) {
+ colorType = kUnknown_SkColorType;
+ }
+ return SkImageInfo::Make(w, h, colorType,
+ opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType,
+ sk_ref_sp(context->getColorSpace()));
+}
+
+SkGpuDevice::SkGpuDevice(sk_sp<GrDrawContext> drawContext, int width, int height, unsigned flags)
+ : INHERITED(make_info(drawContext.get(), width, height, SkToBool(flags & kIsOpaque_Flag)),
+ drawContext->surfaceProps())
, fContext(SkRef(drawContext->accessRenderTarget()->getContext()))
- , fDrawContext(std::move(drawContext)) {
+ , fDrawContext(std::move(drawContext))
+{
fSize.set(width, height);
fOpaque = SkToBool(flags & kIsOpaque_Flag);
« include/core/SkDevice.h ('K') | « src/gpu/SkGpuDevice.h ('k') | src/pdf/SkPDFDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698