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 | |
314 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 308 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
315 | 309 |
316 #include "SkUnPreMultiply.h" | 310 #include "SkUnPreMultiply.h" |
317 #include "SkColorShader.h" | 311 #include "SkColorShader.h" |
318 #include "SkEmptyShader.h" | 312 #include "SkEmptyShader.h" |
319 | 313 |
320 // returns true and set color if the bitmap can be drawn as a single color | 314 // returns true and set color if the bitmap can be drawn as a single color |
321 // (for efficiency) | 315 // (for efficiency) |
322 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { | 316 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { |
323 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 317 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 inner = GrSimpleTextureEffect::Make(texture, matrix, params); | 462 inner = GrSimpleTextureEffect::Make(texture, matrix, params); |
469 } | 463 } |
470 | 464 |
471 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 465 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
472 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); | 466 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne
r)); |
473 } | 467 } |
474 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); | 468 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); |
475 } | 469 } |
476 | 470 |
477 #endif | 471 #endif |
OLD | NEW |