aboutsummaryrefslogtreecommitdiffhomepage
path: root/example/HelloWorld.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-07-28 15:17:34 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-28 15:17:34 -0700
commitecf3dbe8f2987a08b21be1aff61b7fbfbb69640a (patch)
tree99358f3174597d234b1fdba3528dfdc513a09101 /example/HelloWorld.h
parent99fb670977b5566e901cb4b95531a000ed0ec8a9 (diff)
Remove use of MakeRenderTargetDirect from view system
Here is the CL that sent me down the SkGammaColorFilter path GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2178353005 Review-Url: https://codereview.chromium.org/2178353005
Diffstat (limited to 'example/HelloWorld.h')
-rw-r--r--example/HelloWorld.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/example/HelloWorld.h b/example/HelloWorld.h
index deb56ba699..d3fc7cfb16 100644
--- a/example/HelloWorld.h
+++ b/example/HelloWorld.h
@@ -33,14 +33,15 @@ public:
DeviceType getDeviceType() const { return fType; }
protected:
- SkSurface* createSurface() override {
+ sk_sp<SkSurface> makeSurface() override {
SkSurfaceProps props(INHERITED::getSurfaceProps());
if (kGPU_DeviceType == fType) {
- return SkSurface::MakeRenderTargetDirect(fRenderTarget, nullptr, &props).release();
+ return fGpuSurface;
}
- static const SkImageInfo info = SkImageInfo::MakeN32Premul(
- SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
- return fSurface = SkSurface::MakeRaster(info, &props).release();
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(SkScalarRoundToInt(this->width()),
+ SkScalarRoundToInt(this->height()));
+ fRasterSurface = SkSurface::MakeRaster(info, &props);
+ return fRasterSurface;
}
void draw(SkCanvas* canvas) override;
@@ -51,7 +52,7 @@ protected:
private:
bool findNextMatch(); // Set example to the first one that matches FLAGS_match.
void setTitle();
- void setUpRenderTarget();
+ void setUpGpuBackedSurface();
bool onHandleChar(SkUnichar unichar) override;
void tearDownBackend();
@@ -60,9 +61,9 @@ private:
// support framework
DeviceType fType;
- SkSurface* fSurface;
+ sk_sp<SkSurface> fRasterSurface;
GrContext* fContext;
- GrRenderTarget* fRenderTarget;
+ sk_sp<SkSurface> fGpuSurface;
AttachmentInfo fAttachmentInfo;
const GrGLInterface* fInterface;