Revert "Rename getTopDevice/getDevice to topDevice/baseDevice"
This reverts commit 632a23afa4
.
Reason for revert: breaking android roll
Original change's description:
> Rename getTopDevice/getDevice to topDevice/baseDevice
>
> This addresses nit from https://skia-review.googlesource.com/c/skia/+/344663
> and also moves topDevice() to be private, since it's not really meant
> for arbitrary subclasses to access anyways. Classes outside of SkCanvas
> that need topDevice/baseDevice are already friended anyways.
>
> Bug: skia:10987
> Change-Id: Ib0b0dffb5b1c35d5a0c78aeb8903e4cf0b8810a9
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344960
> Reviewed-by: Mike Klein <mtklein@google.com>
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Michael Ludwig <michaelludwig@google.com>
TBR=mtklein@google.com,reed@google.com,michaelludwig@google.com
Change-Id: I9b70230f7db5d31cede2ea03e7abc7c154021204
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: skia:10987
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/345158
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
parent
7acddf59d6
commit
d8b939e0b4
@ -2586,6 +2586,8 @@ protected:
|
||||
bool clipRectBounds(const SkRect* bounds, SkIRect* intersection,
|
||||
const SkImageFilter* imageFilter = nullptr);
|
||||
|
||||
SkBaseDevice* getTopDevice() const;
|
||||
|
||||
private:
|
||||
static void DrawDeviceWithFilter(SkBaseDevice* src, const SkImageFilter* filter,
|
||||
SkBaseDevice* dst, const SkIPoint& dstOrigin,
|
||||
@ -2602,15 +2604,7 @@ private:
|
||||
void predrawNotify(bool willOverwritesEntireSurface = false);
|
||||
void predrawNotify(const SkRect* rect, const SkPaint* paint, ShaderOverrideOpacity);
|
||||
|
||||
// The bottom-most device in the stack, only changed by init(). Image properties and the final
|
||||
// canvas pixels are determined by this device.
|
||||
SkBaseDevice* baseDevice();
|
||||
const SkBaseDevice* baseDevice() const;
|
||||
|
||||
// The top-most device in the stack, will change within saveLayer()'s. All drawing and clipping
|
||||
// operations should route to this device.
|
||||
SkBaseDevice* topDevice();
|
||||
const SkBaseDevice* topDevice() const;
|
||||
SkBaseDevice* getDevice() const;
|
||||
|
||||
class MCRec;
|
||||
|
||||
|
@ -89,8 +89,8 @@ bool SkCanvas::wouldOverwriteEntireSurface(const SkRect* rect, const SkPaint* pa
|
||||
|
||||
// if we're clipped at all, we can't overwrite the entire surface
|
||||
{
|
||||
const SkBaseDevice* base = this->baseDevice();
|
||||
const SkBaseDevice* top = this->topDevice();
|
||||
SkBaseDevice* base = this->getDevice();
|
||||
SkBaseDevice* top = this->getTopDevice();
|
||||
if (base != top) {
|
||||
return false; // we're in a saveLayer, so conservatively don't assume we'll overwrite
|
||||
}
|
||||
@ -553,33 +553,25 @@ SkSurface* SkCanvas::getSurface() const {
|
||||
}
|
||||
|
||||
SkISize SkCanvas::getBaseLayerSize() const {
|
||||
return this->baseDevice()->imageInfo().dimensions();
|
||||
return this->getDevice()->imageInfo().dimensions();
|
||||
}
|
||||
|
||||
SkIRect SkCanvas::internalGetTopLayerBounds() const {
|
||||
return this->topDevice()->getGlobalBounds();
|
||||
return this->getTopDevice()->getGlobalBounds();
|
||||
}
|
||||
|
||||
const SkBaseDevice* SkCanvas::baseDevice() const {
|
||||
SkASSERT(fBaseDevice);
|
||||
return fBaseDevice.get();
|
||||
}
|
||||
SkBaseDevice* SkCanvas::baseDevice() {
|
||||
SkBaseDevice* SkCanvas::getDevice() const {
|
||||
SkASSERT(fBaseDevice);
|
||||
return fBaseDevice.get();
|
||||
}
|
||||
|
||||
const SkBaseDevice* SkCanvas::topDevice() const {
|
||||
SkASSERT(fMCRec->fDevice);
|
||||
return fMCRec->fDevice;
|
||||
}
|
||||
SkBaseDevice* SkCanvas::topDevice() {
|
||||
SkBaseDevice* SkCanvas::getTopDevice() const {
|
||||
SkASSERT(fMCRec->fDevice);
|
||||
return fMCRec->fDevice;
|
||||
}
|
||||
|
||||
bool SkCanvas::readPixels(const SkPixmap& pm, int x, int y) {
|
||||
return pm.addr() && this->baseDevice()->readPixels(pm, x, y);
|
||||
return pm.addr() && this->getDevice()->readPixels(pm, x, y);
|
||||
}
|
||||
|
||||
bool SkCanvas::readPixels(const SkImageInfo& dstInfo, void* dstP, size_t rowBytes, int x, int y) {
|
||||
@ -601,7 +593,7 @@ bool SkCanvas::writePixels(const SkBitmap& bitmap, int x, int y) {
|
||||
|
||||
bool SkCanvas::writePixels(const SkImageInfo& srcInfo, const void* pixels, size_t rowBytes,
|
||||
int x, int y) {
|
||||
SkBaseDevice* device = this->baseDevice();
|
||||
SkBaseDevice* device = this->getDevice();
|
||||
|
||||
// This check gives us an early out and prevents generation ID churn on the surface.
|
||||
// This is purely optional: it is a subset of the checks performed by SkWritePixelsRec.
|
||||
@ -692,7 +684,7 @@ void SkCanvas::restoreToCount(int count) {
|
||||
void SkCanvas::internalSave() {
|
||||
fMCRec = new (fMCStack.push_back()) MCRec(*fMCRec);
|
||||
|
||||
this->topDevice()->save();
|
||||
this->getTopDevice()->save();
|
||||
}
|
||||
|
||||
bool SkCanvas::clipRectBounds(const SkRect* bounds, SkIRect* intersection,
|
||||
@ -1030,7 +1022,7 @@ void SkCanvas::internalSaveLayer(const SaveLayerRec& rec, SaveLayerStrategy stra
|
||||
strategy = kNoLayer_SaveLayerStrategy;
|
||||
}
|
||||
|
||||
SkBaseDevice* priorDevice = this->topDevice();
|
||||
SkBaseDevice* priorDevice = this->getTopDevice();
|
||||
sk_sp<SkBaseDevice> newDevice;
|
||||
if (strategy == kFullLayer_SaveLayerStrategy) {
|
||||
SkASSERT(!ir.isEmpty());
|
||||
@ -1091,7 +1083,7 @@ int SkCanvas::saveLayerAlpha(const SkRect* bounds, U8CPU alpha) {
|
||||
}
|
||||
|
||||
void SkCanvas::internalSaveBehind(const SkRect* localBounds) {
|
||||
SkBaseDevice* device = this->topDevice();
|
||||
SkBaseDevice* device = this->getTopDevice();
|
||||
|
||||
// Map the local bounds into the top device's coordinate space (this is not
|
||||
// necessarily the full global CTM transform).
|
||||
@ -1148,12 +1140,12 @@ void SkCanvas::internalRestore() {
|
||||
return;
|
||||
}
|
||||
|
||||
this->topDevice()->restore(fMCRec->fMatrix);
|
||||
this->getTopDevice()->restore(fMCRec->fMatrix);
|
||||
|
||||
if (backImage) {
|
||||
SkPaint paint;
|
||||
paint.setBlendMode(SkBlendMode::kDstOver);
|
||||
this->topDevice()->drawSpecial(backImage->fImage.get(),
|
||||
this->getTopDevice()->drawSpecial(backImage->fImage.get(),
|
||||
SkMatrix::Translate(backImage->fLoc.x(),
|
||||
backImage->fLoc.y()),
|
||||
paint);
|
||||
@ -1185,7 +1177,7 @@ sk_sp<SkSurface> SkCanvas::makeSurface(const SkImageInfo& info, const SkSurfaceP
|
||||
}
|
||||
|
||||
sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
|
||||
return this->baseDevice()->makeSurface(info, props);
|
||||
return this->getDevice()->makeSurface(info, props);
|
||||
}
|
||||
|
||||
SkImageInfo SkCanvas::imageInfo() const {
|
||||
@ -1193,7 +1185,7 @@ SkImageInfo SkCanvas::imageInfo() const {
|
||||
}
|
||||
|
||||
SkImageInfo SkCanvas::onImageInfo() const {
|
||||
return this->baseDevice()->imageInfo();
|
||||
return this->getDevice()->imageInfo();
|
||||
}
|
||||
|
||||
bool SkCanvas::getProps(SkSurfaceProps* props) const {
|
||||
@ -1201,10 +1193,15 @@ bool SkCanvas::getProps(SkSurfaceProps* props) const {
|
||||
}
|
||||
|
||||
bool SkCanvas::onGetProps(SkSurfaceProps* props) const {
|
||||
if (props) {
|
||||
*props = fProps;
|
||||
SkBaseDevice* dev = this->getDevice();
|
||||
if (dev) {
|
||||
if (props) {
|
||||
*props = fProps;
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SkCanvas::peekPixels(SkPixmap* pmap) {
|
||||
@ -1212,7 +1209,7 @@ bool SkCanvas::peekPixels(SkPixmap* pmap) {
|
||||
}
|
||||
|
||||
bool SkCanvas::onPeekPixels(SkPixmap* pmap) {
|
||||
return this->baseDevice()->peekPixels(pmap);
|
||||
return this->getDevice()->peekPixels(pmap);
|
||||
}
|
||||
|
||||
void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin) {
|
||||
@ -1233,8 +1230,8 @@ void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoi
|
||||
// instead of an origin, just don't expose the pixels in that case. Note that this means
|
||||
// that layers with complex coordinate spaces can still report their pixels if the caller
|
||||
// does not ask for the origin (e.g. just to dump its output to a file, etc).
|
||||
if (this->topDevice()->isPixelAlignedToGlobal()) {
|
||||
*origin = this->topDevice()->getOrigin();
|
||||
if (this->getTopDevice()->isPixelAlignedToGlobal()) {
|
||||
*origin = this->getTopDevice()->getOrigin();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1243,7 +1240,7 @@ void* SkCanvas::accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoi
|
||||
}
|
||||
|
||||
bool SkCanvas::onAccessTopLayerPixels(SkPixmap* pmap) {
|
||||
return this->topDevice()->accessPixels(pmap);
|
||||
return this->getTopDevice()->accessPixels(pmap);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -1271,7 +1268,7 @@ void SkCanvas::internalDrawDevice(SkBaseDevice* srcDev, const SkPaint* paint) {
|
||||
}
|
||||
SkASSERT(!noFilterPaint.getImageFilter());
|
||||
|
||||
SkBaseDevice* dstDev = this->topDevice();
|
||||
SkBaseDevice* dstDev = this->getTopDevice();
|
||||
check_drawdevice_colorspaces(dstDev->imageInfo().colorSpace(),
|
||||
srcDev->imageInfo().colorSpace());
|
||||
|
||||
@ -1313,7 +1310,7 @@ void SkCanvas::translate(SkScalar dx, SkScalar dy) {
|
||||
// so we still have to compute this.
|
||||
fIsScaleTranslate = SkMatrixPriv::IsScaleTranslateAsM33(fMCRec->fMatrix);
|
||||
|
||||
this->topDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
this->getTopDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
|
||||
this->didTranslate(dx,dy);
|
||||
}
|
||||
@ -1328,7 +1325,7 @@ void SkCanvas::scale(SkScalar sx, SkScalar sy) {
|
||||
// but pre-scaling by a non-finite does change it, so we have to recompute.
|
||||
fIsScaleTranslate = SkMatrixPriv::IsScaleTranslateAsM33(fMCRec->fMatrix);
|
||||
|
||||
this->topDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
this->getTopDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
|
||||
this->didScale(sx, sy);
|
||||
}
|
||||
@ -1366,7 +1363,7 @@ void SkCanvas::internalConcat44(const SkM44& m) {
|
||||
|
||||
fIsScaleTranslate = SkMatrixPriv::IsScaleTranslateAsM33(fMCRec->fMatrix);
|
||||
|
||||
this->topDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
this->getTopDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
}
|
||||
|
||||
void SkCanvas::concat(const SkM44& m) {
|
||||
@ -1379,7 +1376,7 @@ void SkCanvas::internalSetMatrix(const SkM44& m) {
|
||||
fMCRec->fMatrix = m;
|
||||
fIsScaleTranslate = SkMatrixPriv::IsScaleTranslateAsM33(m);
|
||||
|
||||
this->topDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
this->getTopDevice()->setGlobalCTM(fMCRec->fMatrix);
|
||||
}
|
||||
|
||||
void SkCanvas::setMatrix(const SkMatrix& matrix) {
|
||||
@ -1425,7 +1422,7 @@ void SkCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeSty
|
||||
const bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
|
||||
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->clipRect(rect, op, isAA);
|
||||
this->getTopDevice()->clipRect(rect, op, isAA);
|
||||
}
|
||||
|
||||
void SkCanvas::androidFramework_setDeviceClipRestriction(const SkIRect& rect) {
|
||||
@ -1437,14 +1434,14 @@ void SkCanvas::androidFramework_setDeviceClipRestriction(const SkIRect& rect) {
|
||||
}
|
||||
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->androidFramework_setDeviceClipRestriction(&fClipRestrictionRect);
|
||||
this->getTopDevice()->androidFramework_setDeviceClipRestriction(&fClipRestrictionRect);
|
||||
}
|
||||
|
||||
void SkCanvas::androidFramework_replaceClip(const SkIRect& rect) {
|
||||
this->checkForDeferredSave();
|
||||
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->replaceClip(rect);
|
||||
this->getTopDevice()->replaceClip(rect);
|
||||
}
|
||||
|
||||
void SkCanvas::clipRRect(const SkRRect& rrect, SkClipOp op, bool doAA) {
|
||||
@ -1461,7 +1458,7 @@ void SkCanvas::onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edge
|
||||
bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
|
||||
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->clipRRect(rrect, op, isAA);
|
||||
this->getTopDevice()->clipRRect(rrect, op, isAA);
|
||||
}
|
||||
|
||||
void SkCanvas::clipPath(const SkPath& path, SkClipOp op, bool doAA) {
|
||||
@ -1493,7 +1490,7 @@ void SkCanvas::onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeSty
|
||||
bool isAA = kSoft_ClipEdgeStyle == edgeStyle;
|
||||
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->clipPath(path, op, isAA);
|
||||
this->getTopDevice()->clipPath(path, op, isAA);
|
||||
}
|
||||
|
||||
void SkCanvas::clipShader(sk_sp<SkShader> sh, SkClipOp op) {
|
||||
@ -1515,7 +1512,7 @@ void SkCanvas::clipShader(sk_sp<SkShader> sh, SkClipOp op) {
|
||||
|
||||
void SkCanvas::onClipShader(sk_sp<SkShader> sh, SkClipOp op) {
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->clipShader(sh, op);
|
||||
this->getTopDevice()->clipShader(sh, op);
|
||||
}
|
||||
|
||||
void SkCanvas::clipRegion(const SkRegion& rgn, SkClipOp op) {
|
||||
@ -1525,7 +1522,7 @@ void SkCanvas::clipRegion(const SkRegion& rgn, SkClipOp op) {
|
||||
|
||||
void SkCanvas::onClipRegion(const SkRegion& rgn, SkClipOp op) {
|
||||
AutoUpdateQRBounds aqr(this);
|
||||
this->topDevice()->clipRegion(rgn, op);
|
||||
this->getTopDevice()->clipRegion(rgn, op);
|
||||
}
|
||||
|
||||
void SkCanvas::validateClip() const {
|
||||
@ -1540,12 +1537,12 @@ void SkCanvas::validateClip() const {
|
||||
}
|
||||
|
||||
bool SkCanvas::androidFramework_isClipAA() const {
|
||||
return this->topDevice()->onClipIsAA();
|
||||
return this->getTopDevice()->onClipIsAA();
|
||||
}
|
||||
|
||||
void SkCanvas::temporary_internal_getRgnClip(SkRegion* rgn) {
|
||||
rgn->setEmpty();
|
||||
SkBaseDevice* device = this->topDevice();
|
||||
SkBaseDevice* device = this->getTopDevice();
|
||||
if (device && device->isPixelAlignedToGlobal()) {
|
||||
device->onAsRgnClip(rgn);
|
||||
SkIPoint origin = device->getOrigin();
|
||||
@ -1558,11 +1555,11 @@ void SkCanvas::temporary_internal_getRgnClip(SkRegion* rgn) {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool SkCanvas::isClipEmpty() const {
|
||||
return this->topDevice()->onGetClipType() == SkBaseDevice::ClipType::kEmpty;
|
||||
return this->getTopDevice()->onGetClipType() == SkBaseDevice::ClipType::kEmpty;
|
||||
}
|
||||
|
||||
bool SkCanvas::isClipRect() const {
|
||||
return this->topDevice()->onGetClipType() == SkBaseDevice::ClipType::kRect;
|
||||
return this->getTopDevice()->onGetClipType() == SkBaseDevice::ClipType::kRect;
|
||||
}
|
||||
|
||||
static inline bool is_nan_or_clipped(const Sk4f& devRect, const Sk4f& devClip) {
|
||||
@ -1674,7 +1671,7 @@ SkIRect SkCanvas::getDeviceClipBounds() const {
|
||||
}
|
||||
|
||||
SkRect SkCanvas::computeDeviceClipBounds() const {
|
||||
const SkBaseDevice* dev = this->topDevice();
|
||||
const SkBaseDevice* dev = this->getTopDevice();
|
||||
if (dev->onGetClipType() == SkBaseDevice::ClipType::kEmpty) {
|
||||
return SkRect::MakeEmpty();
|
||||
} else {
|
||||
@ -1694,7 +1691,7 @@ SkM44 SkCanvas::getLocalToDevice() const {
|
||||
}
|
||||
|
||||
GrSurfaceDrawContext* SkCanvas::internal_private_accessTopLayerRenderTargetContext() {
|
||||
return this->topDevice()->accessRenderTargetContext();
|
||||
return this->getTopDevice()->accessRenderTargetContext();
|
||||
}
|
||||
|
||||
#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && SK_SUPPORT_GPU
|
||||
@ -1704,7 +1701,7 @@ GrSurfaceDrawContext* SkCanvas::internal_private_accessTopLayerRenderTargetConte
|
||||
#include "src/gpu/GrSurfaceDrawContext.h"
|
||||
|
||||
GrBackendRenderTarget SkCanvas::topLayerBackendRenderTarget() const {
|
||||
GrSurfaceDrawContext* sdc = this->topDevice()->accessRenderTargetContext();
|
||||
GrSurfaceDrawContext* sdc = this->getTopDevice()->accessRenderTargetContext();
|
||||
if (!sdc) {
|
||||
return {};
|
||||
}
|
||||
@ -1716,7 +1713,7 @@ GrBackendRenderTarget SkCanvas::topLayerBackendRenderTarget() const {
|
||||
#endif
|
||||
|
||||
GrRecordingContext* SkCanvas::recordingContext() {
|
||||
return this->topDevice()->recordingContext();
|
||||
return this->getTopDevice()->recordingContext();
|
||||
}
|
||||
|
||||
void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
|
||||
@ -1993,7 +1990,7 @@ void SkCanvas::onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) {
|
||||
// We don't test quickReject because the shadow outsets the path's bounds.
|
||||
// TODO(michaelludwig): Is it worth calling SkDrawShadowMetrics::GetLocalBounds here?
|
||||
this->predrawNotify();
|
||||
this->topDevice()->drawShadow(path, rec);
|
||||
this->getTopDevice()->drawShadow(path, rec);
|
||||
}
|
||||
|
||||
void SkCanvas::experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4],
|
||||
@ -2035,7 +2032,7 @@ void SkCanvas::internalDrawPaint(const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, nullptr, CheckForOverwrite::kYes);
|
||||
this->topDevice()->drawPaint(layer.paint());
|
||||
this->getTopDevice()->drawPaint(layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
@ -2061,7 +2058,7 @@ void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, strokePaint, &bounds);
|
||||
this->topDevice()->drawPoints(mode, count, pts, layer.paint());
|
||||
this->getTopDevice()->drawPoints(mode, count, pts, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
|
||||
@ -2071,7 +2068,7 @@ void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &r, CheckForOverwrite::kYes);
|
||||
this->topDevice()->drawRect(r, layer.paint());
|
||||
this->getTopDevice()->drawRect(r, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
|
||||
@ -2081,11 +2078,11 @@ void SkCanvas::onDrawRegion(const SkRegion& region, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &bounds);
|
||||
this->topDevice()->drawRegion(region, layer.paint());
|
||||
this->getTopDevice()->drawRegion(region, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawBehind(const SkPaint& paint) {
|
||||
SkBaseDevice* dev = this->topDevice();
|
||||
SkBaseDevice* dev = this->getTopDevice();
|
||||
if (!dev) {
|
||||
return;
|
||||
}
|
||||
@ -2121,7 +2118,7 @@ void SkCanvas::onDrawBehind(const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint);
|
||||
this->topDevice()->drawPaint(layer.paint());
|
||||
this->getTopDevice()->drawPaint(layer.paint());
|
||||
|
||||
dev->restore(fMCRec->fMatrix);
|
||||
}
|
||||
@ -2133,7 +2130,7 @@ void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &oval);
|
||||
this->topDevice()->drawOval(oval, layer.paint());
|
||||
this->getTopDevice()->drawOval(oval, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawArc(const SkRect& oval, SkScalar startAngle,
|
||||
@ -2145,7 +2142,7 @@ void SkCanvas::onDrawArc(const SkRect& oval, SkScalar startAngle,
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &oval);
|
||||
this->topDevice()->drawArc(oval, startAngle, sweepAngle, useCenter, layer.paint());
|
||||
this->getTopDevice()->drawArc(oval, startAngle, sweepAngle, useCenter, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
@ -2167,7 +2164,7 @@ void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &bounds);
|
||||
this->topDevice()->drawRRect(rrect, layer.paint());
|
||||
this->getTopDevice()->drawRRect(rrect, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
|
||||
@ -2177,7 +2174,7 @@ void SkCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const Sk
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &bounds);
|
||||
this->topDevice()->drawDRRect(outer, inner, layer.paint());
|
||||
this->getTopDevice()->drawDRRect(outer, inner, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
@ -2195,7 +2192,7 @@ void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &pathBounds);
|
||||
this->topDevice()->drawPath(path, layer.paint());
|
||||
this->getTopDevice()->drawPath(path, layer.paint());
|
||||
}
|
||||
|
||||
bool SkCanvas::canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPaint& paint) {
|
||||
@ -2251,7 +2248,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
|
||||
!image_to_color_filter(&realPaint)) {
|
||||
// Evaluate the image filter directly on the input image and then draw the result, instead
|
||||
// of first drawing the image to a temporary layer and filtering.
|
||||
SkBaseDevice* device = this->topDevice();
|
||||
SkBaseDevice* device = this->getTopDevice();
|
||||
sk_sp<SkSpecialImage> special;
|
||||
if ((special = device->makeSpecial(image))) {
|
||||
sk_sp<SkImageFilter> filter = realPaint.refImageFilter();
|
||||
@ -2274,7 +2271,7 @@ void SkCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const S
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, realPaint, &bounds);
|
||||
this->topDevice()->drawImageRect(image, nullptr, bounds, layer.paint(),
|
||||
this->getTopDevice()->drawImageRect(image, nullptr, bounds, layer.paint(),
|
||||
kStrict_SrcRectConstraint);
|
||||
}
|
||||
|
||||
@ -2289,7 +2286,7 @@ void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk
|
||||
AutoLayerForImageFilter layer(this, realPaint, &dst, CheckForOverwrite::kYes,
|
||||
image->isOpaque() ? kOpaque_ShaderOverrideOpacity
|
||||
: kNotOpaque_ShaderOverrideOpacity);
|
||||
this->topDevice()->drawImageRect(image, src, dst, layer.paint(), constraint);
|
||||
this->getTopDevice()->drawImageRect(image, src, dst, layer.paint(), constraint);
|
||||
}
|
||||
|
||||
void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y,
|
||||
@ -2328,7 +2325,7 @@ void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, realPaint, &dst);
|
||||
this->topDevice()->drawImageNine(image, center, dst, layer.paint());
|
||||
this->getTopDevice()->drawImageNine(image, center, dst, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst,
|
||||
@ -2340,7 +2337,7 @@ void SkCanvas::onDrawImageLattice(const SkImage* image, const Lattice& lattice,
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, realPaint, &dst);
|
||||
this->topDevice()->drawImageLattice(image, lattice, dst, layer.paint());
|
||||
this->getTopDevice()->drawImageLattice(image, lattice, dst, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
@ -2351,7 +2348,7 @@ void SkCanvas::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, paint, &bounds);
|
||||
fScratchGlyphRunBuilder->drawTextBlob(layer.paint(), *blob, {x, y}, this->topDevice());
|
||||
fScratchGlyphRunBuilder->drawTextBlob(layer.paint(), *blob, {x, y}, this->getTopDevice());
|
||||
}
|
||||
|
||||
// These call the (virtual) onDraw... method
|
||||
@ -2404,7 +2401,7 @@ void SkCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode bmod
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, simplePaint, &bounds);
|
||||
this->topDevice()->drawVertices(vertices, bmode, layer.paint());
|
||||
this->getTopDevice()->drawVertices(vertices, bmode, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::drawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
@ -2433,7 +2430,7 @@ void SkCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, simplePaint, &bounds);
|
||||
this->topDevice()->drawPatch(cubics, colors, texCoords, bmode, layer.paint());
|
||||
this->getTopDevice()->drawPatch(cubics, colors, texCoords, bmode, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::drawDrawable(SkDrawable* dr, SkScalar x, SkScalar y) {
|
||||
@ -2464,7 +2461,7 @@ void SkCanvas::onDrawDrawable(SkDrawable* dr, const SkMatrix* matrix) {
|
||||
// drawable bounds are no longer reliable (e.g. android displaylist)
|
||||
// so don't use them for quick-reject
|
||||
this->predrawNotify();
|
||||
this->baseDevice()->drawDrawable(dr, matrix, this);
|
||||
this->getDevice()->drawDrawable(dr, matrix, this);
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[],
|
||||
@ -2478,14 +2475,14 @@ void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, realPaint);
|
||||
this->topDevice()->drawAtlas(atlas, xform, tex, colors, count, bmode, layer.paint());
|
||||
this->getTopDevice()->drawAtlas(atlas, xform, tex, colors, count, bmode, layer.paint());
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) {
|
||||
SkASSERT(key);
|
||||
|
||||
this->predrawNotify();
|
||||
this->topDevice()->drawAnnotation(rect, key, value);
|
||||
this->getTopDevice()->drawAnnotation(rect, key, value);
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFlags edgeAA,
|
||||
@ -2499,7 +2496,7 @@ void SkCanvas::onDrawEdgeAAQuad(const SkRect& r, const SkPoint clip[4], QuadAAFl
|
||||
}
|
||||
|
||||
this->predrawNotify();
|
||||
this->topDevice()->drawEdgeAAQuad(r, clip, edgeAA, color, mode);
|
||||
this->getTopDevice()->drawEdgeAAQuad(r, clip, edgeAA, color, mode);
|
||||
}
|
||||
|
||||
void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
||||
@ -2539,7 +2536,7 @@ void SkCanvas::onDrawEdgeAAImageSet(const ImageSetEntry imageSet[], int count,
|
||||
}
|
||||
|
||||
AutoLayerForImageFilter layer(this, realPaint, setBoundsValid ? &setBounds : nullptr);
|
||||
this->topDevice()->drawEdgeAAImageSet(imageSet, count, dstClips, preViewMatrices,
|
||||
this->getTopDevice()->drawEdgeAAImageSet(imageSet, count, dstClips, preViewMatrices,
|
||||
layer.paint(), constraint);
|
||||
}
|
||||
|
||||
@ -2709,7 +2706,7 @@ static_assert((int)SkRegion::kReplace_Op == (int)kReplace_SkClipOp, "
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
SkRasterHandleAllocator::Handle SkCanvas::accessTopRasterHandle() const {
|
||||
const SkBaseDevice* dev = this->topDevice();
|
||||
const SkBaseDevice* dev = this->getTopDevice();
|
||||
if (fAllocator) {
|
||||
SkRasterHandleAllocator::Handle handle = dev->getRasterHandle();
|
||||
SkIRect clip = dev->devClipBounds();
|
||||
|
@ -144,7 +144,7 @@ void SkSurface_Raster::onCopyOnWrite(ContentChangeMode mode) {
|
||||
// what is being used by the image. Next we update the canvas to use
|
||||
// this as its backend, so we can't modify the image's pixels anymore.
|
||||
SkASSERT(this->getCachedCanvas());
|
||||
this->getCachedCanvas()->baseDevice()->replaceBitmapBackendForRasterSurface(fBitmap);
|
||||
this->getCachedCanvas()->getDevice()->replaceBitmapBackendForRasterSurface(fBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) {
|
||||
// Historically, the canvas state could report multiple top-level layers because SkCanvas
|
||||
// supported unclipped layers. With that feature removed, there is only ever 0 to 1 "layers",
|
||||
// and all required information is contained by the canvas' top-most device.
|
||||
SkBaseDevice* device = canvas->topDevice();
|
||||
SkBaseDevice* device = canvas->getTopDevice();
|
||||
if (!device) {
|
||||
return nullptr;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user