BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=
1922123002
TBR=robertphilips
Review URL: https://codereview.chromium.org/
1922123002
*/
virtual const SkBitmap& onAccessBitmap() = 0;
+ virtual GrContext* context() const { return nullptr; }
+
protected:
virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&);
virtual bool onPeekPixels(SkPixmap*) { return false; }
}
GrContext* SkCanvas::getGrContext() {
-#if SK_SUPPORT_GPU
SkBaseDevice* device = this->getTopDevice();
- if (device) {
- GrRenderTarget* renderTarget = device->accessRenderTarget();
- if (renderTarget) {
- return renderTarget->getContext();
- }
- }
-#endif
-
- return nullptr;
-
+ return device ? device->context() : nullptr;
}
void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
return static_cast<SkGpuDevice*>(dev);
}
- GrContext* context() const { return fContext; }
+ GrContext* context() const override { return fContext; }
// set all pixels to 0
void clearAll();