Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 1245883003: Move LightingShader to effects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address 64b gcc memory issues (seems to require more space than others) Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkBitmapProcState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index eeb43b4886cb8bdb5d9bfaed8c965adf9dbab5ce..5a33af55bab7a4dba63b4ba6964495d727bfa6df 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -17,20 +17,6 @@
#include "effects/GrBicubicEffect.h"
#endif
-bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
- switch (bm.colorType()) {
- case kAlpha_8_SkColorType:
- case kRGB_565_SkColorType:
- case kIndex_8_SkColorType:
- case kN32_SkColorType:
- // if (tx == ty && (kClamp_TileMode == tx || kRepeat_TileMode == tx))
- return true;
- default:
- break;
- }
- return false;
-}
-
SkBitmapProcShader::SkBitmapProcShader(const SkBitmap& src, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix)
: INHERITED(localMatrix) {
@@ -267,7 +253,7 @@ void SkBitmapProcShader::BitmapProcShaderContext::shadeSpan16(int x, int y, uint
// returns true and set color if the bitmap can be drawn as a single color
// (for efficiency)
-static bool canUseColorShader(const SkBitmap& bm, SkColor* color) {
+static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) {
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
// HWUI does not support color shaders (see b/22390304)
return false;
@@ -298,14 +284,14 @@ static bool canUseColorShader(const SkBitmap& bm, SkColor* color) {
return false;
}
-static bool bitmapIsTooBig(const SkBitmap& bm) {
+static bool bitmap_is_too_big(const SkBitmap& bm) {
// SkBitmapProcShader stores bitmap coordinates in a 16bit buffer, as it
// communicates between its matrix-proc and its sampler-proc. Until we can
// widen that, we have to reject bitmaps that are larger.
//
- const int maxSize = 65535;
+ static const int kMaxSize = 65535;
- return bm.width() > maxSize || bm.height() > maxSize;
+ return bm.width() > kMaxSize || bm.height() > kMaxSize;
}
SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
@@ -313,14 +299,13 @@ SkShader* SkCreateBitmapShader(const SkBitmap& src, SkShader::TileMode tmx,
SkTBlitterAllocator* allocator) {
SkShader* shader;
SkColor color;
- if (src.isNull() || bitmapIsTooBig(src)) {
+ if (src.isNull() || bitmap_is_too_big(src)) {
if (NULL == allocator) {
shader = SkNEW(SkEmptyShader);
} else {
shader = allocator->createT<SkEmptyShader>();
}
- }
- else if (canUseColorShader(src, &color)) {
+ } else if (can_use_color_shader(src, &color)) {
if (NULL == allocator) {
shader = SkNEW_ARGS(SkColorShader, (color));
} else {
« no previous file with comments | « src/core/SkBitmapProcShader.h ('k') | src/core/SkBitmapProcState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698