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

Unified Diff: src/effects/SkRectShaderImageFilter.cpp

Issue 1575233004: Delete SkRectShaderImageFilter (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkRectShaderImageFilter.h ('k') | src/ports/SkGlobalInitialization_chromium.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkRectShaderImageFilter.cpp
diff --git a/src/effects/SkRectShaderImageFilter.cpp b/src/effects/SkRectShaderImageFilter.cpp
deleted file mode 100644
index b3cdd896f1e80dba2a0cfd74f24769d983c3f14a..0000000000000000000000000000000000000000
--- a/src/effects/SkRectShaderImageFilter.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkRectShaderImageFilter.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkDevice.h"
-#include "SkReadBuffer.h"
-#include "SkWriteBuffer.h"
-#include "SkShader.h"
-
-SkImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const SkRect& rect) {
- SkASSERT(s);
- uint32_t flags = CropRect::kHasAll_CropEdge;
- if (rect.width() == 0 || rect.height() == 0) {
- flags = 0x0;
- }
- CropRect cropRect(rect, flags);
- return s ? new SkRectShaderImageFilter(s, &cropRect) : nullptr;
-}
-
-SkImageFilter* SkRectShaderImageFilter::Create(SkShader* s, const CropRect* cropRect) {
- SkASSERT(s);
- return s ? new SkRectShaderImageFilter(s, cropRect) : nullptr;
-}
-
-SkRectShaderImageFilter::SkRectShaderImageFilter(SkShader* s, const CropRect* cropRect)
- : INHERITED(0, nullptr, cropRect)
- , fShader(SkRef(s)) {
-}
-
-SkFlattenable* SkRectShaderImageFilter::CreateProc(SkReadBuffer& buffer) {
- SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 0);
- SkAutoTUnref<SkShader> shader(buffer.readShader());
- return Create(shader.get(), &common.cropRect());
-}
-
-void SkRectShaderImageFilter::flatten(SkWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
- buffer.writeFlattenable(fShader);
-}
-
-SkRectShaderImageFilter::~SkRectShaderImageFilter() {
- fShader->unref();
-}
-
-bool SkRectShaderImageFilter::onFilterImage(Proxy* proxy,
- const SkBitmap& source,
- const Context& ctx,
- SkBitmap* result,
- SkIPoint* offset) const {
- SkIRect bounds;
- if (!this->applyCropRect(ctx, source, SkIPoint::Make(0, 0), &bounds)) {
- return false;
- }
-
- SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(),
- bounds.height()));
- if (nullptr == device.get()) {
- return false;
- }
- SkCanvas canvas(device.get());
-
- SkPaint paint;
- SkMatrix matrix(ctx.ctm());
- matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- SkSafeUnref(paint.setShader(fShader->newWithLocalMatrix(matrix)));
-
- SkRect rect = SkRect::MakeWH(SkIntToScalar(bounds.width()), SkIntToScalar(bounds.height()));
- canvas.drawRect(rect, paint);
-
- *result = device.get()->accessBitmap(false);
- offset->fX = bounds.fLeft;
- offset->fY = bounds.fTop;
- return true;
-}
-
-bool SkRectShaderImageFilter::canComputeFastBounds() const {
- // http:skbug.com/4627: "make computeFastBounds and onFilterBounds() CropRect-aware"
- // computeFastBounds() doesn't currently take the crop rect into account,
- // so we can't compute it. If a full crop rect is set, we should return true here.
- return false;
-}
-
-#ifndef SK_IGNORE_TO_STRING
-void SkRectShaderImageFilter::toString(SkString* str) const {
- str->appendf("SkRectShaderImageFilter: (");
- str->append(")");
-}
-#endif
« no previous file with comments | « include/effects/SkRectShaderImageFilter.h ('k') | src/ports/SkGlobalInitialization_chromium.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698