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

Unified Diff: src/views/SkParsePaint.cpp

Issue 1744043002: remove unused view helpers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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/views/SkBGViewArtist.cpp ('k') | src/views/SkViewInflate.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/SkParsePaint.cpp
diff --git a/src/views/SkParsePaint.cpp b/src/views/SkParsePaint.cpp
deleted file mode 100644
index 1a1b7067bad8f01ac405d9a948e53106fbbb7314..0000000000000000000000000000000000000000
--- a/src/views/SkParsePaint.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SkParsePaint.h"
-#include "SkTSearch.h"
-#include "SkParse.h"
-#include "SkImageDecoder.h"
-#include "SkGradientShader.h"
-
-static SkShader* inflate_shader(const SkDOM& dom, const SkDOM::Node* node)
-{
- if ((node = dom.getFirstChild(node, "shader")) == nullptr)
- return nullptr;
-
- const char* str;
-
- if (dom.hasAttr(node, "type", "linear-gradient"))
- {
- SkColor colors[2];
- SkPoint pts[2];
-
- colors[0] = colors[1] = SK_ColorBLACK; // need to initialized the alpha to opaque, since FindColor doesn't set it
- if ((str = dom.findAttr(node, "c0")) != nullptr &&
- SkParse::FindColor(str, &colors[0]) &&
- (str = dom.findAttr(node, "c1")) != nullptr &&
- SkParse::FindColor(str, &colors[1]) &&
- dom.findScalars(node, "p0", &pts[0].fX, 2) &&
- dom.findScalars(node, "p1", &pts[1].fX, 2))
- {
- SkShader::TileMode mode = SkShader::kClamp_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
- return SkGradientShader::CreateLinear(pts, colors, nullptr, 2, mode);
- }
- }
- else if (dom.hasAttr(node, "type", "bitmap"))
- {
- if ((str = dom.findAttr(node, "src")) == nullptr)
- return nullptr;
-
- SkBitmap bm;
-
- if (SkImageDecoder::DecodeFile(str, &bm))
- {
- SkShader::TileMode mode = SkShader::kRepeat_TileMode;
- int index;
-
- if ((index = dom.findList(node, "tile-mode", "clamp,repeat,mirror")) >= 0)
- mode = (SkShader::TileMode)index;
-
- return SkShader::CreateBitmapShader(bm, mode, mode);
- }
- }
- return nullptr;
-}
-
-void SkPaint_Inflate(SkPaint* paint, const SkDOM& dom, const SkDOM::Node* node)
-{
- SkASSERT(paint);
- SkASSERT(&dom);
- SkASSERT(node);
-
- SkScalar x;
-
- if (dom.findScalar(node, "stroke-width", &x))
- paint->setStrokeWidth(x);
- if (dom.findScalar(node, "text-size", &x))
- paint->setTextSize(x);
-
- bool b;
-
- SkASSERT("legacy: use is-stroke" && !dom.findBool(node, "is-frame", &b));
-
- if (dom.findBool(node, "is-stroke", &b))
- paint->setStyle(b ? SkPaint::kStroke_Style : SkPaint::kFill_Style);
- if (dom.findBool(node, "is-antialias", &b))
- paint->setAntiAlias(b);
- if (dom.findBool(node, "is-lineartext", &b))
- paint->setLinearText(b);
-
- const char* str = dom.findAttr(node, "color");
- if (str)
- {
- SkColor c = paint->getColor();
- if (SkParse::FindColor(str, &c))
- paint->setColor(c);
- }
-
- // do this AFTER parsing for the color
- if (dom.findScalar(node, "opacity", &x))
- {
- x = SkMaxScalar(0, SkMinScalar(x, SK_Scalar1));
- paint->setAlpha(SkScalarRoundToInt(x * 255));
- }
-
- int index = dom.findList(node, "text-anchor", "left,center,right");
- if (index >= 0)
- paint->setTextAlign((SkPaint::Align)index);
-
- SkShader* shader = inflate_shader(dom, node);
- if (shader)
- paint->setShader(shader)->unref();
-}
« no previous file with comments | « src/views/SkBGViewArtist.cpp ('k') | src/views/SkViewInflate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698