aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-12-20 08:57:26 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-20 14:39:45 +0000
commit22f4a1fd4859aa75133de37a24b3201cce5d6844 (patch)
tree526e4c78647cb3596fab756c8442c454f67a6826
parent1bfcf887553a9d39b25f0d8c408b78841cd9d8fc (diff)
Remove getDevice_just_for_deprecated_compatibility_test()
BUG=skia:6067 Change-Id: I646e75f43bc77ea884b7fad7281bf0b684996bb9 Reviewed-on: https://skia-review.googlesource.com/6299 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
-rw-r--r--include/core/SkCanvas.h3
-rw-r--r--include/gpu/GrContext.h2
-rw-r--r--samplecode/SampleAnimatedText.cpp8
-rw-r--r--src/gpu/SkGpuDevice.h3
-rw-r--r--tests/GrTextureStripAtlasTest.cpp1
-rw-r--r--tools/debugger/SkDebugCanvas.cpp9
-rw-r--r--tools/gpu/GrTest.cpp30
7 files changed, 14 insertions, 42 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 18b23ff2e7..e2302665f0 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -166,9 +166,6 @@ protected: // Can we make this private?
#endif
SkBaseDevice* getDevice() const;
public:
- SkBaseDevice* getDevice_just_for_deprecated_compatibility_testing() const {
- return this->getDevice();
- }
/**
* saveLayer() can create another device (which is later drawn onto
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 9fa134d166..8add0e75d6 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -365,7 +365,7 @@ public:
void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const;
/** Get pointer to atlas texture for given mask format */
- GrTexture* getFontAtlasTexture(GrMaskFormat format);
+ sk_sp<SkImage> getFontAtlasImage(GrMaskFormat format);
GrAuditTrail* getAuditTrail() { return &fAuditTrail; }
diff --git a/samplecode/SampleAnimatedText.cpp b/samplecode/SampleAnimatedText.cpp
index dec8f8f49d..cc672ff18b 100644
--- a/samplecode/SampleAnimatedText.cpp
+++ b/samplecode/SampleAnimatedText.cpp
@@ -19,7 +19,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "SkGpuDevice.h"
#endif
SkRandom gRand;
@@ -102,12 +101,11 @@ protected:
canvas->save();
#if SK_SUPPORT_GPU
- SkBaseDevice* device = canvas->getDevice_just_for_deprecated_compatibility_testing();
GrContext* grContext = canvas->getGrContext();
if (grContext) {
- GrTexture* tex = grContext->getFontAtlasTexture(GrMaskFormat::kA8_GrMaskFormat);
- reinterpret_cast<SkGpuDevice*>(device)->drawTexture(tex,
- SkRect::MakeXYWH(512, 10, 512, 512), paint);
+ sk_sp<SkImage> image = grContext->getFontAtlasImage(GrMaskFormat::kA8_GrMaskFormat);
+ canvas->drawImageRect(image,
+ SkRect::MakeXYWH(512.0f, 10.0f, 512.0f, 512.0f), &paint);
}
#endif
canvas->translate(180, 180);
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index 098505074a..29452146d1 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -121,9 +121,6 @@ public:
bool onAccessPixels(SkPixmap*) override;
- // for debugging purposes only
- void drawTexture(GrTexture*, const SkRect& dst, const SkPaint&);
-
protected:
bool onReadPixels(const SkImageInfo&, void*, size_t, int, int) override;
bool onWritePixels(const SkImageInfo&, const void*, size_t, int, int) override;
diff --git a/tests/GrTextureStripAtlasTest.cpp b/tests/GrTextureStripAtlasTest.cpp
index bf95cafeb3..2def782f38 100644
--- a/tests/GrTextureStripAtlasTest.cpp
+++ b/tests/GrTextureStripAtlasTest.cpp
@@ -13,7 +13,6 @@
#include "GrGpu.h"
#include "GrTextureStripAtlas.h"
#include "GrTypes.h"
-#include "SkGpuDevice.h"
// This tests that GrTextureStripAtlas flushes pending IO on the texture it acquires.
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrTextureStripAtlasFlush, reporter, ctxInfo) {
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index b42c529f03..8199796d72 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -16,8 +16,7 @@
#if SK_SUPPORT_GPU
#include "GrAuditTrail.h"
#include "GrContext.h"
-#include "GrRenderTarget.h"
-#include "SkGpuDevice.h"
+#include "GrRenderTargetContext.h"
#endif
#define SKDEBUGCANVAS_VERSION 1
@@ -348,10 +347,8 @@ void SkDebugCanvas::drawTo(SkCanvas* canvas, int index, int m) {
static const SkColor kOtherBatchBounds = SkColorSetARGB(0xC0, 0xFF, 0x7F, 0x00);
// get the render target of the top device so we can ignore batches drawn offscreen
- SkBaseDevice* bd = canvas->getDevice_just_for_deprecated_compatibility_testing();
- SkGpuDevice* gbd = reinterpret_cast<SkGpuDevice*>(bd);
- GrGpuResource::UniqueID rtID =
- gbd->accessRenderTargetContext()->accessRenderTarget()->uniqueID();
+ GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext();
+ GrGpuResource::UniqueID rtID = rtc->accessRenderTarget()->uniqueID();
// get the bounding boxes to draw
SkTArray<GrAuditTrail::BatchInfo> childrenBounds;
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 6fc2f82f23..79891f4b44 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -16,8 +16,8 @@
#include "GrRenderTargetProxy.h"
#include "GrResourceCache.h"
-#include "SkGpuDevice.h"
#include "SkGrPriv.h"
+#include "SkImage_Gpu.h"
#include "SkMathPriv.h"
#include "SkString.h"
@@ -138,32 +138,16 @@ void GrContext::printGpuStats() const {
SkDebugf("%s", out.c_str());
}
-GrTexture* GrContext::getFontAtlasTexture(GrMaskFormat format) {
+sk_sp<SkImage> GrContext::getFontAtlasImage(GrMaskFormat format) {
GrAtlasGlyphCache* cache = this->getAtlasGlyphCache();
- return cache->getTexture(format);
+ GrTexture* tex = cache->getTexture(format);
+ sk_sp<SkImage> image(new SkImage_Gpu(tex->width(), tex->height(),
+ kNeedNewImageUniqueID, kPremul_SkAlphaType,
+ sk_ref_sp(tex), nullptr, SkBudgeted::kNo));
+ return image;
}
-void SkGpuDevice::drawTexture(GrTexture* tex, const SkRect& dst, const SkPaint& paint) {
- GrPaint grPaint;
- SkMatrix mat;
- mat.reset();
- if (!SkPaintToGrPaint(this->context(), fRenderTargetContext.get(), paint, mat, &grPaint)) {
- return;
- }
- SkMatrix textureMat;
- textureMat.reset();
- textureMat[SkMatrix::kMScaleX] = 1.0f/dst.width();
- textureMat[SkMatrix::kMScaleY] = 1.0f/dst.height();
- textureMat[SkMatrix::kMTransX] = -dst.fLeft/dst.width();
- textureMat[SkMatrix::kMTransY] = -dst.fTop/dst.height();
-
- grPaint.addColorTextureProcessor(tex, nullptr, textureMat);
-
- fRenderTargetContext->drawRect(GrNoClip(), grPaint, GrAA::kNo, mat, dst);
-}
-
-
#if GR_GPU_STATS
void GrGpu::Stats::dump(SkString* out) {
out->appendf("Render Target Binds: %d\n", fRenderTargetBinds);