OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBitmapProcShader.h" | 8 #include "SkBitmapProcShader.h" |
9 #include "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
10 #include "SkBitmapProvider.h" | 10 #include "SkBitmapProvider.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 buffer.writeMatrix(this->getLocalMatrix()); | 298 buffer.writeMatrix(this->getLocalMatrix()); |
299 buffer.writeBitmap(fRawBitmap); | 299 buffer.writeBitmap(fRawBitmap); |
300 buffer.writeUInt(fTileModeX); | 300 buffer.writeUInt(fTileModeX); |
301 buffer.writeUInt(fTileModeY); | 301 buffer.writeUInt(fTileModeY); |
302 } | 302 } |
303 | 303 |
304 bool SkBitmapProcShader::isOpaque() const { | 304 bool SkBitmapProcShader::isOpaque() const { |
305 return fRawBitmap.isOpaque(); | 305 return fRawBitmap.isOpaque(); |
306 } | 306 } |
307 | 307 |
| 308 bool SkBitmapProcShader::BitmapIsTooBig(const SkBitmap& bm) { |
| 309 static const int kMaxSize = 65535; |
| 310 |
| 311 return bm.width() > kMaxSize || bm.height() > kMaxSize; |
| 312 } |
| 313 |
308 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 314 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
309 | 315 |
310 #include "SkUnPreMultiply.h" | 316 #include "SkUnPreMultiply.h" |
311 #include "SkColorShader.h" | 317 #include "SkColorShader.h" |
312 #include "SkEmptyShader.h" | 318 #include "SkEmptyShader.h" |
313 | 319 |
314 // returns true and set color if the bitmap can be drawn as a single color | 320 // returns true and set color if the bitmap can be drawn as a single color |
315 // (for efficiency) | 321 // (for efficiency) |
316 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { | 322 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { |
317 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 323 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 inner = GrSimpleTextureEffect::Make(texture, matrix, params); | 468 inner = GrSimpleTextureEffect::Make(texture, matrix, params); |
463 } | 469 } |
464 | 470 |
465 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 471 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
466 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); | 472 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); |
467 } | 473 } |
468 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); | 474 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); |
469 } | 475 } |
470 | 476 |
471 #endif | 477 #endif |
OLD | NEW |