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

Unified Diff: src/effects/SkLerpXfermode.cpp

Issue 1611633002: Remove SkLerpXfermode (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove recent usages 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 | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkToFromValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLerpXfermode.cpp
diff --git a/src/effects/SkLerpXfermode.cpp b/src/effects/SkLerpXfermode.cpp
deleted file mode 100644
index a069e8b367a0d67fd201ca7e1db96065bd7958b1..0000000000000000000000000000000000000000
--- a/src/effects/SkLerpXfermode.cpp
+++ /dev/null
@@ -1,118 +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 "SkLerpXfermode.h"
-#include "SkColorPriv.h"
-#include "SkReadBuffer.h"
-#include "SkWriteBuffer.h"
-#include "SkString.h"
-#include "SkValue.h"
-#include "SkValueKeys.h"
-
-SkXfermode* SkLerpXfermode::Create(SkScalar scale) {
- int scale256 = SkScalarRoundToInt(scale * 256);
- if (scale256 >= 256) {
- return SkXfermode::Create(SkXfermode::kSrc_Mode);
- } else if (scale256 <= 0) {
- return SkXfermode::Create(SkXfermode::kDst_Mode);
- }
- return new SkLerpXfermode(scale256);
-}
-
-SkLerpXfermode::SkLerpXfermode(unsigned scale256) : fScale256(scale256) {}
-
-void SkLerpXfermode::flatten(SkWriteBuffer& buffer) const {
- buffer.writeUInt(fScale256);
-}
-
-SkFlattenable* SkLerpXfermode::CreateProc(SkReadBuffer& buffer) {
- return new SkLerpXfermode(buffer.readUInt());
-}
-
-void SkLerpXfermode::xfer32(SkPMColor dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const {
- const int scale = fScale256;
-
- if (aa) {
- for (int i = 0; i < count; ++i) {
- unsigned a = aa[i];
- if (a) {
- SkPMColor dstC = dst[i];
- SkPMColor resC = SkFastFourByteInterp256(src[i], dstC, scale);
- if (a < 255) {
- resC = SkFastFourByteInterp256(resC, dstC, a + (a >> 7));
- }
- dst[i] = resC;
- }
- }
- } else {
- for (int i = 0; i < count; ++i) {
- dst[i] = SkFastFourByteInterp256(src[i], dst[i], scale);
- }
- }
-}
-
-void SkLerpXfermode::xfer16(uint16_t dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const {
- const int scale = fScale256;
-
- if (aa) {
- for (int i = 0; i < count; ++i) {
- unsigned a = aa[i];
- if (a) {
- SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
- SkPMColor resC = SkFastFourByteInterp256(src[i], dstC, scale);
- if (a < 255) {
- resC = SkFastFourByteInterp256(resC, dstC, a + (a >> 7));
- }
- dst[i] = SkPixel32ToPixel16(resC);
- }
- }
- } else {
- for (int i = 0; i < count; ++i) {
- SkPMColor dstC = SkPixel16ToPixel32(dst[i]);
- SkPMColor resC = SkFastFourByteInterp256(src[i], dstC, scale);
- dst[i] = SkPixel32ToPixel16(resC);
- }
- }
-}
-
-void SkLerpXfermode::xferA8(SkAlpha dst[], const SkPMColor src[], int count,
- const SkAlpha aa[]) const {
- const int scale = fScale256;
-
- if (aa) {
- for (int i = 0; i < count; ++i) {
- unsigned a = aa[i];
- if (a) {
- unsigned dstA = dst[i];
- unsigned resA = SkAlphaBlend(SkGetPackedA32(src[i]), dstA, scale);
- if (a < 255) {
- resA = SkAlphaBlend(resA, dstA, a + (a >> 7));
- }
- dst[i] = resA;
- }
- }
- } else {
- for (int i = 0; i < count; ++i) {
- dst[i] = SkAlphaBlend(SkGetPackedA32(src[i]), dst[i], scale);
- }
- }
-}
-
-#ifndef SK_IGNORE_TO_STRING
-void SkLerpXfermode::toString(SkString* str) const {
- str->printf("SkLerpXfermode: scale: %g", fScale256 / 256.0);
-}
-#endif
-
-SkValue SkLerpXfermode::asValue() const {
- auto value = SkValue::Object(SkValue::LerpXfermode);
- value.set(SkValueKeys::LerpXfermode::kScale,
- SkValue::FromF32(fScale256 / 256.0f));
- return value;
-}
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkToFromValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698