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

Unified Diff: ui/gfx/skia_util.cc

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 years, 9 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 | « ui/gfx/skia_util.h ('k') | ui/gfx/x/x11_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skia_util.cc
diff --git a/ui/gfx/skia_util.cc b/ui/gfx/skia_util.cc
index ac98f4920e08a181bf2004601b55b85b6d0e0062..15df1eac9417d2f2ea5b659fc2905f0a02974d5a 100644
--- a/ui/gfx/skia_util.cc
+++ b/ui/gfx/skia_util.cc
@@ -11,8 +11,9 @@
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "third_party/skia/include/effects/SkLayerDrawLooper.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/rect_f.h"
+#include "ui/gfx/geometry/quad_f.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/transform.h"
namespace gfx {
@@ -45,6 +46,15 @@ RectF SkRectToRectF(const SkRect& rect) {
SkScalarToFloat(rect.height()));
}
+SkSize SizeFToSkSize(const SizeF& size) {
+ return SkSize::Make(SkFloatToScalar(size.width()),
+ SkFloatToScalar(size.height()));
+}
+
+SizeF SkSizeToSizeF(const SkSize& size) {
+ return SizeF(SkScalarToFloat(size.width()), SkScalarToFloat(size.height()));
+}
+
void TransformToFlattenedSkMatrix(const gfx::Transform& transform,
SkMatrix* flattened) {
// Convert from 4x4 to 3x3 by dropping the third row and column.
@@ -99,7 +109,7 @@ void ConvertSkiaToRGBA(const unsigned char* skia,
const uint32_t pixel_in = *reinterpret_cast<const uint32_t*>(&skia[i]);
// Pack the components here.
- int alpha = SkGetPackedA32(pixel_in);
+ SkAlpha alpha = SkGetPackedA32(pixel_in);
if (alpha != 0 && alpha != 255) {
SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel_in);
rgba[i + 0] = SkColorGetR(unmultiplied);
@@ -115,4 +125,11 @@ void ConvertSkiaToRGBA(const unsigned char* skia,
}
}
+void QuadFToSkPoints(const gfx::QuadF& quad, SkPoint points[4]) {
+ points[0] = SkPoint::Make(quad.p1().x(), quad.p1().y());
+ points[1] = SkPoint::Make(quad.p2().x(), quad.p2().y());
+ points[2] = SkPoint::Make(quad.p3().x(), quad.p3().y());
+ points[3] = SkPoint::Make(quad.p4().x(), quad.p4().y());
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/skia_util.h ('k') | ui/gfx/x/x11_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698