| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDrawShader.h" | 10 #include "SkDrawShader.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 bool SkDrawShader::add() { | 31 bool SkDrawShader::add() { |
| 32 if (fPaint->shader != (SkDrawShader*) -1) | 32 if (fPaint->shader != (SkDrawShader*) -1) |
| 33 return true; | 33 return true; |
| 34 fPaint->shader = this; | 34 fPaint->shader = this; |
| 35 fPaint->fOwnsShader = true; | 35 fPaint->fOwnsShader = true; |
| 36 return false; | 36 return false; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void SkDrawShader::addPostlude(SkShader* shader) { | 39 SkMatrix* SkDrawShader::getMatrix() { |
| 40 if (matrix) | 40 return matrix ? &matrix->getMatrix() : NULL; |
| 41 shader->setLocalMatrix(matrix->getMatrix()); | |
| 42 } | 41 } |
| 43 | 42 |
| 44 #if SK_USE_CONDENSED_INFO == 0 | 43 #if SK_USE_CONDENSED_INFO == 0 |
| 45 | 44 |
| 46 const SkMemberInfo SkDrawBitmapShader::fInfo[] = { | 45 const SkMemberInfo SkDrawBitmapShader::fInfo[] = { |
| 47 SK_MEMBER_INHERITED, | 46 SK_MEMBER_INHERITED, |
| 48 SK_MEMBER(filterBitmap, Boolean), | 47 SK_MEMBER(filterBitmap, Boolean), |
| 49 SK_MEMBER(image, BaseBitmap) | 48 SK_MEMBER(image, BaseBitmap) |
| 50 }; | 49 }; |
| 51 | 50 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 68 return NULL; | 67 return NULL; |
| 69 | 68 |
| 70 // note: bitmap shader now supports independent tile modes for X and Y | 69 // note: bitmap shader now supports independent tile modes for X and Y |
| 71 // we pass the same to both, but later we should extend this flexibility | 70 // we pass the same to both, but later we should extend this flexibility |
| 72 // to the xml (e.g. tileModeX="repeat" tileModeY="clmap") | 71 // to the xml (e.g. tileModeX="repeat" tileModeY="clmap") |
| 73 // | 72 // |
| 74 // oops, bitmapshader no longer takes filterBitmap, but deduces it at | 73 // oops, bitmapshader no longer takes filterBitmap, but deduces it at |
| 75 // draw-time from the paint | 74 // draw-time from the paint |
| 76 SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap, | 75 SkShader* shader = SkShader::CreateBitmapShader(image->fBitmap, |
| 77 (SkShader::TileMode) tileMod
e, | 76 (SkShader::TileMode) tileMod
e, |
| 78 (SkShader::TileMode) tileMod
e); | 77 (SkShader::TileMode) tileMod
e, |
| 78 getMatrix()); |
| 79 SkAutoTDelete<SkShader> autoDel(shader); | 79 SkAutoTDelete<SkShader> autoDel(shader); |
| 80 addPostlude(shader); | |
| 81 (void)autoDel.detach(); | 80 (void)autoDel.detach(); |
| 82 return shader; | 81 return shader; |
| 83 } | 82 } |
| OLD | NEW |