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

Side by Side Diff: src/core/SkBitmapProcShader.cpp

Issue 2043393002: Refactoring of GPU NormalMap handling out into its own class (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Refactoring, style fixes Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 buffer.writeMatrix(this->getLocalMatrix()); 296 buffer.writeMatrix(this->getLocalMatrix());
297 buffer.writeBitmap(fRawBitmap); 297 buffer.writeBitmap(fRawBitmap);
298 buffer.writeUInt(fTileModeX); 298 buffer.writeUInt(fTileModeX);
299 buffer.writeUInt(fTileModeY); 299 buffer.writeUInt(fTileModeY);
300 } 300 }
301 301
302 bool SkBitmapProcShader::isOpaque() const { 302 bool SkBitmapProcShader::isOpaque() const {
303 return fRawBitmap.isOpaque(); 303 return fRawBitmap.isOpaque();
304 } 304 }
305 305
306 bool SkBitmapProcShader::bitmapIsTooBig(const SkBitmap& bm) {
307 // SkBitmapProcShader stores bitmap coordinates in a 16bit buffer, as it
308 // communicates between its matrix-proc and its sampler-proc. Until we can
309 // widen that, we have to reject bitmaps that are larger.
310 //
311 static const int kMaxSize = 65535;
312
313 return bm.width() > kMaxSize || bm.height() > kMaxSize;
314 }
315
306 //////////////////////////////////////////////////////////////////////////////// /////////////////// 316 //////////////////////////////////////////////////////////////////////////////// ///////////////////
307 317
308 #include "SkUnPreMultiply.h" 318 #include "SkUnPreMultiply.h"
309 #include "SkColorShader.h" 319 #include "SkColorShader.h"
310 #include "SkEmptyShader.h" 320 #include "SkEmptyShader.h"
311 321
312 // returns true and set color if the bitmap can be drawn as a single color 322 // returns true and set color if the bitmap can be drawn as a single color
313 // (for efficiency) 323 // (for efficiency)
314 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) { 324 static bool can_use_color_shader(const SkBitmap& bm, SkColor* color) {
315 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 325 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 inner = GrSimpleTextureEffect::Make(texture, matrix, params); 470 inner = GrSimpleTextureEffect::Make(texture, matrix, params);
461 } 471 }
462 472
463 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 473 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
464 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r)); 474 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r));
465 } 475 }
466 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 476 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
467 } 477 }
468 478
469 #endif 479 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698