aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental
diff options
context:
space:
mode:
authorGravatar skia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-10 02:01:29 +0000
committerGravatar skia.committer@gmail.com <skia.committer@gmail.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-01-10 02:01:29 +0000
commite04cf0cf1d281b4e282dbd5d2eb2de553bc1d2b7 (patch)
tree8a212d6005b90abf9c67be79dc7095dca7e9e575 /experimental
parent13ac3a3ddaa5144ae2ac5984cccb0c8383ba8c8c (diff)
Sanitizing source files in Skia_Periodic_House_Keeping
git-svn-id: http://skia.googlecode.com/svn/trunk@7113 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental')
-rw-r--r--experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp150
1 files changed, 75 insertions, 75 deletions
diff --git a/experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp b/experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp
index c2bb708f13..f74a57a0c3 100644
--- a/experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp
+++ b/experimental/AndroidPathRenderer/GrAndroidPathRenderer.cpp
@@ -1,75 +1,75 @@
-
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrAndroidPathRenderer.h"
-#include "AndroidPathRenderer.h"
-#include "Vertex.h"
-
-GrAndroidPathRenderer::GrAndroidPathRenderer() {
-}
-
-bool GrAndroidPathRenderer::canDrawPath(const SkPath& path,
- const SkStrokeRec& stroke,
- const GrDrawTarget* target,
- bool antiAlias) const {
- return ((stroke.isFillStyle() || stroke.getStyle() == SkStrokeRec::kStroke_Style)
- && !path.isInverseFillType() && path.isConvex());
-}
-
-struct ColorVertex {
- SkPoint pos;
- GrColor color;
-};
-
-bool GrAndroidPathRenderer::onDrawPath(const SkPath& origPath,
- const SkStrokeRec& stroke,
- GrDrawTarget* target,
- bool antiAlias) {
-
- // generate verts using Android algorithm
- android::uirenderer::VertexBuffer vertices;
- android::uirenderer::PathRenderer::ConvexPathVertices(origPath, stroke, antiAlias, NULL,
- &vertices);
-
- // set vertex layout depending on anti-alias
- GrVertexLayout layout = antiAlias ? GrDrawTarget::kCoverage_VertexLayoutBit : 0;
-
- // allocate our vert buffer
- int vertCount = vertices.getSize();
- GrDrawTarget::AutoReleaseGeometry geo(target, layout, vertCount, 0);
- if (!geo.succeeded()) {
- GrPrintf("Failed to get space for vertices!\n");
- return false;
- }
-
- // copy android verts to our vertex buffer
- if (antiAlias) {
- ColorVertex* outVert = reinterpret_cast<ColorVertex*>(geo.vertices());
- android::uirenderer::AlphaVertex* inVert =
- reinterpret_cast<android::uirenderer::AlphaVertex*>(vertices.getBuffer());
-
- for (int i = 0; i < vertCount; ++i) {
- // copy vertex position
- outVert->pos.set(inVert->position[0], inVert->position[1]);
- // copy alpha
- int coverage = static_cast<int>(inVert->alpha * 0xff);
- outVert->color = GrColorPackRGBA(coverage, coverage, coverage, coverage);
- ++outVert;
- ++inVert;
- }
- } else {
- size_t vsize = GrDrawTarget::VertexSize(layout);
- size_t copySize = vsize*vertCount;
- memcpy(geo.vertices(), vertices.getBuffer(), copySize);
- }
-
- // render it
- target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, vertCount);
-
- return true;
-}
+
+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "GrAndroidPathRenderer.h"
+#include "AndroidPathRenderer.h"
+#include "Vertex.h"
+
+GrAndroidPathRenderer::GrAndroidPathRenderer() {
+}
+
+bool GrAndroidPathRenderer::canDrawPath(const SkPath& path,
+ const SkStrokeRec& stroke,
+ const GrDrawTarget* target,
+ bool antiAlias) const {
+ return ((stroke.isFillStyle() || stroke.getStyle() == SkStrokeRec::kStroke_Style)
+ && !path.isInverseFillType() && path.isConvex());
+}
+
+struct ColorVertex {
+ SkPoint pos;
+ GrColor color;
+};
+
+bool GrAndroidPathRenderer::onDrawPath(const SkPath& origPath,
+ const SkStrokeRec& stroke,
+ GrDrawTarget* target,
+ bool antiAlias) {
+
+ // generate verts using Android algorithm
+ android::uirenderer::VertexBuffer vertices;
+ android::uirenderer::PathRenderer::ConvexPathVertices(origPath, stroke, antiAlias, NULL,
+ &vertices);
+
+ // set vertex layout depending on anti-alias
+ GrVertexLayout layout = antiAlias ? GrDrawTarget::kCoverage_VertexLayoutBit : 0;
+
+ // allocate our vert buffer
+ int vertCount = vertices.getSize();
+ GrDrawTarget::AutoReleaseGeometry geo(target, layout, vertCount, 0);
+ if (!geo.succeeded()) {
+ GrPrintf("Failed to get space for vertices!\n");
+ return false;
+ }
+
+ // copy android verts to our vertex buffer
+ if (antiAlias) {
+ ColorVertex* outVert = reinterpret_cast<ColorVertex*>(geo.vertices());
+ android::uirenderer::AlphaVertex* inVert =
+ reinterpret_cast<android::uirenderer::AlphaVertex*>(vertices.getBuffer());
+
+ for (int i = 0; i < vertCount; ++i) {
+ // copy vertex position
+ outVert->pos.set(inVert->position[0], inVert->position[1]);
+ // copy alpha
+ int coverage = static_cast<int>(inVert->alpha * 0xff);
+ outVert->color = GrColorPackRGBA(coverage, coverage, coverage, coverage);
+ ++outVert;
+ ++inVert;
+ }
+ } else {
+ size_t vsize = GrDrawTarget::VertexSize(layout);
+ size_t copySize = vsize*vertCount;
+ memcpy(geo.vertices(), vertices.getBuffer(), copySize);
+ }
+
+ // render it
+ target->drawNonIndexed(kTriangleStrip_GrPrimitiveType, 0, vertCount);
+
+ return true;
+}