| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkTileImageFilter.h" | 8 #include "SkTileImageFilter.h" |
| 9 | 9 |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } else { | 80 } else { |
| 81 sk_sp<SkSurface> surf(input->makeTightSurface(ctx.outputProperties(), sr
cIRect.size())); | 81 sk_sp<SkSurface> surf(input->makeTightSurface(ctx.outputProperties(), sr
cIRect.size())); |
| 82 if (!surf) { | 82 if (!surf) { |
| 83 return nullptr; | 83 return nullptr; |
| 84 } | 84 } |
| 85 | 85 |
| 86 SkCanvas* canvas = surf->getCanvas(); | 86 SkCanvas* canvas = surf->getCanvas(); |
| 87 SkASSERT(canvas); | 87 SkASSERT(canvas); |
| 88 | 88 |
| 89 SkPaint paint; | 89 SkPaint paint; |
| 90 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 90 paint.setBlendMode(SkBlendMode::kSrc); |
| 91 | 91 |
| 92 input->draw(canvas, | 92 input->draw(canvas, |
| 93 SkIntToScalar(inputOffset.x()), SkIntToScalar(inputOffset.y(
)), | 93 SkIntToScalar(inputOffset.x()), SkIntToScalar(inputOffset.y(
)), |
| 94 &paint); | 94 &paint); |
| 95 | 95 |
| 96 subset = surf->makeImageSnapshot(); | 96 subset = surf->makeImageSnapshot(); |
| 97 } | 97 } |
| 98 SkASSERT(subset->width() == srcIRect.width()); | 98 SkASSERT(subset->width() == srcIRect.width()); |
| 99 SkASSERT(subset->height() == srcIRect.height()); | 99 SkASSERT(subset->height() == srcIRect.height()); |
| 100 | 100 |
| 101 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), dst
IRect.size())); | 101 sk_sp<SkSpecialSurface> surf(source->makeSurface(ctx.outputProperties(), dst
IRect.size())); |
| 102 if (!surf) { | 102 if (!surf) { |
| 103 return nullptr; | 103 return nullptr; |
| 104 } | 104 } |
| 105 | 105 |
| 106 SkCanvas* canvas = surf->getCanvas(); | 106 SkCanvas* canvas = surf->getCanvas(); |
| 107 SkASSERT(canvas); | 107 SkASSERT(canvas); |
| 108 | 108 |
| 109 SkPaint paint; | 109 SkPaint paint; |
| 110 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 110 paint.setBlendMode(SkBlendMode::kSrc); |
| 111 paint.setShader(subset->makeShader(SkShader::kRepeat_TileMode, SkShader::kRe
peat_TileMode)); | 111 paint.setShader(subset->makeShader(SkShader::kRepeat_TileMode, SkShader::kRe
peat_TileMode)); |
| 112 canvas->translate(-dstRect.fLeft, -dstRect.fTop); | 112 canvas->translate(-dstRect.fLeft, -dstRect.fTop); |
| 113 canvas->drawRect(dstRect, paint); | 113 canvas->drawRect(dstRect, paint); |
| 114 offset->fX = dstIRect.fLeft; | 114 offset->fX = dstIRect.fLeft; |
| 115 offset->fY = dstIRect.fTop; | 115 offset->fY = dstIRect.fTop; |
| 116 return surf->makeImageSnapshot(); | 116 return surf->makeImageSnapshot(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 SkIRect SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix
& ctm, | 119 SkIRect SkTileImageFilter::onFilterNodeBounds(const SkIRect& src, const SkMatrix
& ctm, |
| 120 MapDirection direction) const { | 120 MapDirection direction) const { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 str->appendf(" dst: %.2f %.2f %.2f %.2f", | 154 str->appendf(" dst: %.2f %.2f %.2f %.2f", |
| 155 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); | 155 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto
m); |
| 156 if (this->getInput(0)) { | 156 if (this->getInput(0)) { |
| 157 str->appendf("input: ("); | 157 str->appendf("input: ("); |
| 158 this->getInput(0)->toString(str); | 158 this->getInput(0)->toString(str); |
| 159 str->appendf(")"); | 159 str->appendf(")"); |
| 160 } | 160 } |
| 161 str->append(")"); | 161 str->append(")"); |
| 162 } | 162 } |
| 163 #endif | 163 #endif |
| OLD | NEW |