diff options
author | Herb Derby <herb@google.com> | 2017-02-07 14:25:11 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-07 20:01:20 +0000 |
commit | 83e939bcb79790f5ae3b28c398fbcf034675a6e5 (patch) | |
tree | 40b52134dece685757f7a1c1c69aa575a82f5100 /gm | |
parent | 77a7a1b57c16c97f056c1e50c03bdc954947778c (diff) |
Use SkArenaAlloc in the SkAutoBlitterChoose code.
- Added default implementation of onMakeContext to support use in android.
Searches for uses:
"public SkShader" package:^chromium$ -file:^src/third_party/skia
package:^aosp.* "public SkShader" -file:external/skia -file:.*third_party/skia
package:^android$ "public SkShader" -file:external/skia -file:.*third_party/skia
... shows that no subclass overrides onCreateContext.
TBR=reed@google.com
TBR=mtklein@google.com
Change-Id: I8bd5f57a79534574e344b165d31dccee41c31767
Reviewed-on: https://skia-review.googlesource.com/8140
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'gm')
-rw-r--r-- | gm/SkLinearBitmapPipelineGM.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gm/SkLinearBitmapPipelineGM.cpp b/gm/SkLinearBitmapPipelineGM.cpp index e8816452fe..1bf43013c9 100644 --- a/gm/SkLinearBitmapPipelineGM.cpp +++ b/gm/SkLinearBitmapPipelineGM.cpp @@ -6,6 +6,8 @@ */ #include "gm.h" + +#include "SkArenaAlloc.h" #include "SkBlitter.h" #include "SkCanvas.h" #include "SkColor.h" @@ -59,7 +61,7 @@ static void draw_rect_orig(SkCanvas* canvas, const SkRect& r, SkColor c, const S sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, pmsrc.addr32(), pmsrc.rowBytes()))); SkPaint paint; - int32_t storage[kSkBlitterContextSize]; + SkArenaAlloc alloc{kSkBlitterContextSize * sizeof(uint32_t)}; sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode); @@ -73,9 +75,8 @@ static void draw_rect_orig(SkCanvas* canvas, const SkRect& r, SkColor c, const S const SkShader::ContextRec rec(paint, *mat, nullptr, SkBlitter::PreferredShaderDest(pmsrc.info()), canvas->imageInfo().colorSpace()); - SkASSERT(paint.getShader()->contextSize(rec) <= sizeof(storage)); - SkShader::Context* ctx = paint.getShader()->createContext(rec, storage); + SkShader::Context* ctx = paint.getShader()->makeContext(rec, &alloc); for (int y = 0; y < ir.height(); y++) { ctx->shadeSpan(0, y, pmdst.writable_addr32(0, y), ir.width()); |