aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-22 10:57:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-22 10:57:16 -0700
commit7715e06b68a1f07f07d23c63e7128d32654e30e9 (patch)
tree262e93f8adb91025a184801671d3165ce369111a
parent272aa12c63e32c2845cbb5549660c08c31159282 (diff)
Retract SkDevice a bit more
-rw-r--r--gm/srcmode.cpp4
-rw-r--r--gm/xfermodes3.cpp1
-rw-r--r--include/core/SkImageFilter.h1
-rw-r--r--samplecode/SampleApp.cpp2
-rw-r--r--src/gpu/GrLayerHoister.cpp11
-rw-r--r--src/gpu/GrLayerHoister.h4
-rw-r--r--src/gpu/text/GrStencilAndCoverTextContext.cpp2
-rw-r--r--src/image/SkImage_Gpu.cpp1
-rw-r--r--tests/PremulAlphaRoundTripTest.cpp34
-rw-r--r--tests/ReadWriteAlphaTest.cpp11
10 files changed, 30 insertions, 41 deletions
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 93a9bc7f05..0d02cdceb0 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -11,10 +11,6 @@
#include "SkPath.h"
#include "SkSurface.h"
-#if SK_SUPPORT_GPU
- #include "SkGpuDevice.h"
-#endif
-
#define W SkIntToScalar(80)
#define H SkIntToScalar(60)
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index e5c8dd5eb7..2b554b6c11 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -14,7 +14,6 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "SkGpuDevice.h"
#endif
namespace skiagm {
diff --git a/include/core/SkImageFilter.h b/include/core/SkImageFilter.h
index a31403fd8c..9758fde964 100644
--- a/include/core/SkImageFilter.h
+++ b/include/core/SkImageFilter.h
@@ -18,7 +18,6 @@
class GrContext;
class GrFragmentProcessor;
-class SkBaseDevice;
class SkColorFilter;
struct SkIPoint;
class SkSpecialImage;
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index df091ae26d..ba2e6ccad1 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -37,7 +37,7 @@
# include "gl/GrGLUtil.h"
# include "GrRenderTarget.h"
# include "GrContext.h"
-# include "SkGpuDevice.h"
+# include "SkGr.h"
# if SK_ANGLE
# include "gl/angle/GLTestContext_angle.h"
# endif
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 38aff8c2f3..c768b7f3a4 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -5,18 +5,17 @@
* found in the LICENSE file.
*/
+#include "GrContext.h"
#include "GrLayerCache.h"
#include "GrLayerHoister.h"
#include "GrRecordReplaceDraw.h"
#include "SkBigPicture.h"
#include "SkCanvas.h"
-#include "SkGpuDevice.h"
#include "SkLayerInfo.h"
#include "SkRecordDraw.h"
#include "SkSpecialImage.h"
#include "SkSurface.h"
-#include "SkSurface_Gpu.h"
// Create the layer information for the hoisted layer and secure the
// required texture/render target resources.
@@ -278,7 +277,7 @@ void GrLayerHoister::DrawLayersToAtlas(GrContext* context,
}
void GrLayerHoister::FilterLayer(GrContext* context,
- SkGpuDevice* device,
+ const SkSurfaceProps* props,
const GrHoistedLayer& info) {
GrCachedLayer* layer = info.fLayer;
@@ -305,7 +304,7 @@ void GrLayerHoister::FilterLayer(GrContext* context,
sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset,
kNeedNewImageUniqueID_SpecialImage,
layer->texture(),
- &device->surfaceProps()));
+ props));
SkIPoint offset = SkIPoint::Make(0, 0);
sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(),
@@ -358,9 +357,7 @@ void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
layerCanvas->flush();
if (layer->filter()) {
- SkSurface_Gpu* gpuSurf = static_cast<SkSurface_Gpu*>(surface.get());
-
- FilterLayer(context, gpuSurf->getDevice(), layers[i]);
+ FilterLayer(context, &surface->props(), layers[i]);
}
}
}
diff --git a/src/gpu/GrLayerHoister.h b/src/gpu/GrLayerHoister.h
index 8b338a8224..044e36b761 100644
--- a/src/gpu/GrLayerHoister.h
+++ b/src/gpu/GrLayerHoister.h
@@ -114,10 +114,10 @@ public:
private:
/** Update the GrTexture in 'layer' with its filtered version
@param context Owner of the layer cache (and thus the layers)
- @param device Required by the filtering code
+ @param props Surface properties
@param info Layer info for a layer needing filtering prior to being composited
*/
- static void FilterLayer(GrContext* context, SkGpuDevice* device, const GrHoistedLayer& info);
+ static void FilterLayer(GrContext* context, const SkSurfaceProps*, const GrHoistedLayer& info);
};
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 1355036ffe..8f6b8baa8e 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -7,6 +7,7 @@
#include "GrStencilAndCoverTextContext.h"
#include "GrAtlasTextContext.h"
+#include "GrContext.h"
#include "GrDrawContext.h"
#include "GrPath.h"
#include "GrPathRange.h"
@@ -16,7 +17,6 @@
#include "SkDraw.h"
#include "SkDrawProcs.h"
#include "SkGlyphCache.h"
-#include "SkGpuDevice.h"
#include "SkGrPriv.h"
#include "SkDrawFilter.h"
#include "SkPath.h"
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d667c3ea7e..359c775fdb 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -13,7 +13,6 @@
#include "effects/GrYUVEffect.h"
#include "SkCanvas.h"
#include "SkBitmapCache.h"
-#include "SkGpuDevice.h"
#include "SkGrPixelRef.h"
#include "SkGrPriv.h"
#include "SkImage_Gpu.h"
diff --git a/tests/PremulAlphaRoundTripTest.cpp b/tests/PremulAlphaRoundTripTest.cpp
index 26badb66c4..14ab7216f2 100644
--- a/tests/PremulAlphaRoundTripTest.cpp
+++ b/tests/PremulAlphaRoundTripTest.cpp
@@ -5,15 +5,14 @@
* found in the LICENSE file.
*/
-#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkConfig8888.h"
+#include "SkSurface.h"
#include "Test.h"
#include "sk_tool_utils.h"
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "SkGpuDevice.h"
#endif
static uint32_t pack_unpremul_rgba(SkColor c) {
@@ -46,7 +45,7 @@ const struct {
{ kBGRA_8888_SkColorType, pack_unpremul_bgra },
};
-static void fillCanvas(SkCanvas* canvas, SkColorType colorType, PackUnpremulProc proc) {
+static void fill_canvas(SkCanvas* canvas, SkColorType colorType, PackUnpremulProc proc) {
// Don't strictly need a bitmap, but its a handy way to allocate the pixels
SkBitmap bmp;
bmp.allocN32Pixels(256, 256);
@@ -63,10 +62,10 @@ static void fillCanvas(SkCanvas* canvas, SkColorType colorType, PackUnpremulProc
canvas->writePixels(info, bmp.getPixels(), bmp.rowBytes(), 0, 0);
}
-static void test_premul_alpha_roundtrip(skiatest::Reporter* reporter, SkBaseDevice* device) {
- SkCanvas canvas(device);
+static void test_premul_alpha_roundtrip(skiatest::Reporter* reporter, SkSurface* surf) {
+ SkCanvas* canvas = surf->getCanvas();
for (size_t upmaIdx = 0; upmaIdx < SK_ARRAY_COUNT(gUnpremul); ++upmaIdx) {
- fillCanvas(&canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upmaIdx].fPackProc);
+ fill_canvas(canvas, gUnpremul[upmaIdx].fColorType, gUnpremul[upmaIdx].fPackProc);
const SkImageInfo info = SkImageInfo::Make(256, 256, gUnpremul[upmaIdx].fColorType,
kUnpremul_SkAlphaType);
@@ -78,10 +77,10 @@ static void test_premul_alpha_roundtrip(skiatest::Reporter* reporter, SkBaseDevi
readBmp1.eraseColor(0);
readBmp2.eraseColor(0);
- canvas.readPixels(&readBmp1, 0, 0);
- sk_tool_utils::write_pixels(&canvas, readBmp1, 0, 0, gUnpremul[upmaIdx].fColorType,
+ canvas->readPixels(&readBmp1, 0, 0);
+ sk_tool_utils::write_pixels(canvas, readBmp1, 0, 0, gUnpremul[upmaIdx].fColorType,
kUnpremul_SkAlphaType);
- canvas.readPixels(&readBmp2, 0, 0);
+ canvas->readPixels(&readBmp2, 0, 0);
bool success = true;
for (int y = 0; y < 256 && success; ++y) {
@@ -100,17 +99,18 @@ static void test_premul_alpha_roundtrip(skiatest::Reporter* reporter, SkBaseDevi
DEF_TEST(PremulAlphaRoundTrip, reporter) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
- SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- SkAutoTUnref<SkBaseDevice> device(SkBitmapDevice::Create(info, props));
- test_premul_alpha_roundtrip(reporter, device);
+
+ sk_sp<SkSurface> surf(SkSurface::MakeRaster(info));
+
+ test_premul_alpha_roundtrip(reporter, surf.get());
}
#if SK_SUPPORT_GPU
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(PremulAlphaRoundTrip_Gpu, reporter, ctxInfo) {
const SkImageInfo info = SkImageInfo::MakeN32Premul(256, 256);
- SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- SkAutoTUnref<SkBaseDevice> device(
- SkGpuDevice::Create(ctxInfo.fGrContext, SkBudgeted::kNo, info, 0, &props,
- SkGpuDevice::kUninit_InitContents));
- test_premul_alpha_roundtrip(reporter, device);
+
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTarget(ctxInfo.fGrContext,
+ SkBudgeted::kNo,
+ info));
+ test_premul_alpha_roundtrip(reporter, surf.get());
}
#endif
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 1f235fd97a..811ce5840b 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -11,7 +11,8 @@
#if SK_SUPPORT_GPU
#include "GrContext.h"
-#include "SkGpuDevice.h"
+#include "SkCanvas.h"
+#include "SkSurface.h"
// This was made indivisible by 4 to ensure we test setting GL_PACK_ALIGNMENT properly.
static const int X_SIZE = 13;
@@ -92,10 +93,8 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
// Now try writing on the single channel texture (if we could create as a RT).
if (texture->asRenderTarget()) {
- SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
- SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(
- texture->asRenderTarget(), &props, SkGpuDevice::kUninit_InitContents));
- SkCanvas canvas(device);
+ sk_sp<SkSurface> surf(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
+ SkCanvas* canvas = surf->getCanvas();
SkPaint paint;
@@ -103,7 +102,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ReadWriteAlpha, reporter, ctxInfo) {
paint.setColor(SK_ColorWHITE);
- canvas.drawRect(rect, paint);
+ canvas->drawRect(rect, paint);
memset(readback.get(), kClearValue, nonZeroRowBytes * Y_SIZE);
result = texture->readPixels(0, 0, desc.fWidth, desc.fHeight,