aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar herb <herb@google.com>2016-04-08 14:24:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-08 14:24:37 -0700
commit42da45d399d73fe3521d9c18c483fb540ad0723c (patch)
tree0c0253489ba76902947e3a96064e3b9f6ee443bc
parentff3681156ced7718a73eca1e170824866d9e5776 (diff)
Fix context size for benchmakr.
-rw-r--r--bench/SkLinearBitmapPipelineBench.cpp3
-rw-r--r--gm/SkLinearBitmapPipelineGM.cpp3
-rw-r--r--src/core/SkBitmapProcShader.h4
-rw-r--r--tests/SkColor4fTest.cpp3
4 files changed, 9 insertions, 4 deletions
diff --git a/bench/SkLinearBitmapPipelineBench.cpp b/bench/SkLinearBitmapPipelineBench.cpp
index f111aeea9e..caf1844f59 100644
--- a/bench/SkLinearBitmapPipelineBench.cpp
+++ b/bench/SkLinearBitmapPipelineBench.cpp
@@ -8,6 +8,7 @@
#include <memory>
#include "SkColor.h"
#include "SkLinearBitmapPipeline.h"
+#include "SkBitmapProcShader.h"
#include "SkPM4f.h"
#include "Benchmark.h"
#include "SkShader.h"
@@ -193,7 +194,7 @@ struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark {
SkAutoTMalloc<SkPMColor> buffer4b(width*height);
- uint32_t storage[300];
+ uint32_t storage[kSkBlitterContextSize];
const SkShader::ContextRec rec(fPaint, fM, nullptr,
SkShader::ContextRec::kPMColor_DstType);
SkASSERT(fPaint.getShader()->contextSize(rec) <= sizeof(storage));
diff --git a/gm/SkLinearBitmapPipelineGM.cpp b/gm/SkLinearBitmapPipelineGM.cpp
index 1bba1c56f9..845e33979f 100644
--- a/gm/SkLinearBitmapPipelineGM.cpp
+++ b/gm/SkLinearBitmapPipelineGM.cpp
@@ -15,6 +15,7 @@
#include "SkXfermode.h"
#include "SkPM4fPriv.h"
#include "SkShader.h"
+#include "SkBitmapProcShader.h"
static void fill_in_bits(SkBitmap& bm, SkIRect ir, SkColor c, bool premul) {
bm.allocN32Pixels(ir.width(), ir.height());
@@ -59,7 +60,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[400];
+ int32_t storage[kSkBlitterContextSize];
sk_sp<SkShader> shader = image->makeShader(SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode);
diff --git a/src/core/SkBitmapProcShader.h b/src/core/SkBitmapProcShader.h
index e2d3900a17..4df2614ca4 100644
--- a/src/core/SkBitmapProcShader.h
+++ b/src/core/SkBitmapProcShader.h
@@ -50,12 +50,14 @@ private:
typedef SkShader INHERITED;
};
+enum {kSkBlitterContextSize = 2400};
+
// Commonly used allocator. It currently is only used to allocate up to 3 objects. The total
// bytes requested is calculated using one of our large shaders, its context size plus the size of
// an Sk3DBlitter in SkDraw.cpp
// Note that some contexts may contain other contexts (e.g. for compose shaders), but we've not
// yet found a situation where the size below isn't big enough.
-typedef SkSmallAllocator<3, 2400> SkTBlitterAllocator;
+typedef SkSmallAllocator<3, kSkBlitterContextSize> SkTBlitterAllocator;
// If alloc is non-nullptr, it will be used to allocate the returned SkShader, and MUST outlive
// the SkShader.
diff --git a/tests/SkColor4fTest.cpp b/tests/SkColor4fTest.cpp
index 67e8d37d24..00cb3fed27 100644
--- a/tests/SkColor4fTest.cpp
+++ b/tests/SkColor4fTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkBitmapProcShader.h"
#include "SkColor.h"
#include "SkColorMatrixFilter.h"
#include "SkGradientShader.h"
@@ -153,7 +154,7 @@ DEF_TEST(Color4f_shader, reporter) {
SkPaint paint;
for (const auto& rec : recs) {
- uint32_t storage[400];
+ uint32_t storage[kSkBlitterContextSize];
paint.setShader(rec.fFact());
// Encourage 4f context selection. At some point we may need
// to instantiate two separate contexts for optimal 4b/4f selection.