aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-28 14:32:04 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-28 14:32:04 -0700
commit175dd9b5e3d7d749738dac743d2ac360b5340187 (patch)
treeff0ab4b2fb12c714a1723775d031220a68225d6d /src/core
parent801b44c45348144a483793e7b24f4d4092a4f74d (diff)
Clean up test drawContext usage
The general idea is to provide access to SkGpuDevice's drawContext rather than its GrRenderTarget. That is usually what the testing framework actually wants. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1930623003 Review-Url: https://codereview.chromium.org/1930623003
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkCanvas.cpp6
-rw-r--r--src/core/SkMultiPictureDraw.cpp13
2 files changed, 11 insertions, 8 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index c7a9dc72f2..f8b0a0ab0b 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1143,6 +1143,8 @@ static void draw_filter_into_device(SkBaseDevice* src, const SkImageFilter* filt
SkBitmap srcBM;
#if SK_SUPPORT_GPU
+ // TODO: remove this virtual usage of accessRenderTarget! It is preventing
+ // removal of the virtual on SkBaseDevice.
GrRenderTarget* srcRT = src->accessRenderTarget();
if (srcRT && !srcRT->asTexture() && dst->accessRenderTarget()) {
// When both the src & the dst are on the gpu but the src doesn't have a texture,
@@ -1858,9 +1860,9 @@ const SkRegion& SkCanvas::internal_private_getTotalClip() const {
return fMCRec->fRasterClip.forceGetBW();
}
-GrRenderTarget* SkCanvas::internal_private_accessTopLayerRenderTarget() {
+GrDrawContext* SkCanvas::internal_private_accessTopLayerDrawContext() {
SkBaseDevice* dev = this->getTopDevice();
- return dev ? dev->accessRenderTarget() : nullptr;
+ return dev ? dev->accessDrawContext() : nullptr;
}
GrContext* SkCanvas::getGrContext() {
diff --git a/src/core/SkMultiPictureDraw.cpp b/src/core/SkMultiPictureDraw.cpp
index 09efba9377..26e446d2ad 100644
--- a/src/core/SkMultiPictureDraw.cpp
+++ b/src/core/SkMultiPictureDraw.cpp
@@ -16,6 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
+#include "GrDrawContext.h"
#include "GrLayerHoister.h"
#include "GrRecordReplaceDraw.h"
#include "GrRenderTarget.h"
@@ -132,8 +133,8 @@ void SkMultiPictureDraw::draw(bool flush) {
SkMatrix initialMatrix = data.fCanvas->getTotalMatrix();
initialMatrix.preConcat(data.fMatrix);
- GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRenderTarget();
- SkASSERT(rt);
+ GrDrawContext* dc = data.fCanvas->internal_private_accessTopLayerDrawContext();
+ SkASSERT(dc);
// TODO: sorting the cacheable layers from smallest to largest
// would improve the packing and reduce the number of swaps
@@ -142,7 +143,7 @@ void SkMultiPictureDraw::draw(bool flush) {
GrLayerHoister::FindLayersToAtlas(context, data.fPicture, initialMatrix,
clipBounds,
&atlasedNeedRendering, &atlasedRecycled,
- rt->numColorSamples());
+ dc->numColorSamples());
}
}
@@ -168,14 +169,14 @@ void SkMultiPictureDraw::draw(bool flush) {
const SkMatrix initialMatrix = canvas->getTotalMatrix();
- GrRenderTarget* rt = data.fCanvas->internal_private_accessTopLayerRenderTarget();
- SkASSERT(rt);
+ GrDrawContext* dc = data.fCanvas->internal_private_accessTopLayerDrawContext();
+ SkASSERT(dc);
// Find the layers required by this canvas. It will return atlased
// layers in the 'recycled' list since they have already been drawn.
GrLayerHoister::FindLayersToHoist(context, picture, initialMatrix,
clipBounds, &needRendering, &recycled,
- rt->numColorSamples());
+ dc->numColorSamples());
GrLayerHoister::DrawLayers(context, needRendering);