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

Side by Side Diff: include/core/SkShader.h

Issue 1342113002: add ImageShader, sharing code with its Bitmap cousin (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with actual added files Created 5 years, 3 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
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 #ifndef SkShader_DEFINED 8 #ifndef SkShader_DEFINED
9 #define SkShader_DEFINED 9 #define SkShader_DEFINED
10 10
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 * and, if not NULL, the localMatrix. If not, return NULL and ignore the lo calMatrix parameter. 406 * and, if not NULL, the localMatrix. If not, return NULL and ignore the lo calMatrix parameter.
407 * 407 *
408 * Note: the returned shader (if not NULL) will have been ref'd, and it is the responsibility 408 * Note: the returned shader (if not NULL) will have been ref'd, and it is the responsibility
409 * of the caller to balance that with unref() when they are done. 409 * of the caller to balance that with unref() when they are done.
410 */ 410 */
411 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const; 411 virtual SkShader* refAsALocalMatrixShader(SkMatrix* localMatrix) const;
412 412
413 SK_TO_STRING_VIRT() 413 SK_TO_STRING_VIRT()
414 SK_DEFINE_FLATTENABLE_TYPE(SkShader) 414 SK_DEFINE_FLATTENABLE_TYPE(SkShader)
415 415
416 // Should be protected, but sometimes a subclass needs to call it on another shader
417 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
f(malita) 2015/09/15 15:01:41 Befriend SkBitmapProcShader instead?
418
416 protected: 419 protected:
417 void flatten(SkWriteBuffer&) const override; 420 void flatten(SkWriteBuffer&) const override;
418 421
419 bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
420
421 /** 422 /**
422 * Your subclass must also override contextSize() if it overrides onCreateC ontext(). 423 * Your subclass must also override contextSize() if it overrides onCreateC ontext().
423 * Base class impl returns NULL. 424 * Base class impl returns NULL.
424 */ 425 */
425 virtual Context* onCreateContext(const ContextRec&, void* storage) const; 426 virtual Context* onCreateContext(const ContextRec&, void* storage) const;
426 427
427 virtual bool onAsLuminanceColor(SkColor*) const { 428 virtual bool onAsLuminanceColor(SkColor*) const {
428 return false; 429 return false;
429 } 430 }
430 431
431 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const { 432 virtual bool onIsABitmap(SkBitmap*, SkMatrix*, TileMode[2]) const {
432 return false; 433 return false;
433 } 434 }
434 435
435 private: 436 private:
436 // This is essentially const, but not officially so it can be modified in 437 // This is essentially const, but not officially so it can be modified in
437 // constructors. 438 // constructors.
438 SkMatrix fLocalMatrix; 439 SkMatrix fLocalMatrix;
439 440
440 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor. 441 // So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer con structor.
441 friend class SkLocalMatrixShader; 442 friend class SkLocalMatrixShader;
442 443
443 typedef SkFlattenable INHERITED; 444 typedef SkFlattenable INHERITED;
444 }; 445 };
445 446
446 #endif 447 #endif
OLDNEW
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698