Chromium Code Reviews| Index: skia/ext/bitmap_platform_device_win.cc |
| diff --git a/skia/ext/bitmap_platform_device_win.cc b/skia/ext/bitmap_platform_device_win.cc |
| index 1e05997fa48dda5c1e10e0e3ad92195f04797b4b..443a3c4876f7a1324884e8e38ce8811ed0bde7cb 100644 |
| --- a/skia/ext/bitmap_platform_device_win.cc |
| +++ b/skia/ext/bitmap_platform_device_win.cc |
| @@ -54,134 +54,6 @@ HBITMAP CreateHBitmap(int width, int height, bool is_opaque, |
| return hbitmap; |
| } |
| -struct CubicPoints { |
| - SkPoint p[4]; |
| -}; |
| -typedef std::vector<CubicPoints> CubicPath; |
| -typedef std::vector<CubicPath> CubicPaths; |
| - |
| -bool SkPathToCubicPaths(CubicPaths* paths, const SkPath& skpath) { |
| - paths->clear(); |
| - CubicPath* current_path = NULL; |
| - SkPoint current_points[4]; |
| - CubicPoints points_to_add; |
| - SkPath::Iter iter(skpath, false); |
| - for (SkPath::Verb verb = iter.next(current_points); |
| - verb != SkPath::kDone_Verb; |
| - verb = iter.next(current_points)) { |
| - switch (verb) { |
| - case SkPath::kMove_Verb: { // iter.next returns 1 point |
| - // Ignores it since the point is copied in the next operation. See |
| - // SkPath::Iter::next() for reference. |
| - paths->push_back(CubicPath()); |
| - current_path = &paths->back(); |
| - // Skip point addition. |
| - continue; |
| - } |
| - case SkPath::kLine_Verb: { // iter.next returns 2 points |
| - points_to_add.p[0] = current_points[0]; |
| - points_to_add.p[1] = current_points[0]; |
| - points_to_add.p[2] = current_points[1]; |
| - points_to_add.p[3] = current_points[1]; |
| - break; |
| - } |
| - case SkPath::kQuad_Verb: { // iter.next returns 3 points |
| - points_to_add.p[0] = current_points[0]; |
| - points_to_add.p[1] = current_points[1]; |
| - points_to_add.p[2] = current_points[2]; |
| - points_to_add.p[3] = current_points[2]; |
| - break; |
| - } |
| - case SkPath::kCubic_Verb: { // iter.next returns 4 points |
| - points_to_add.p[0] = current_points[0]; |
| - points_to_add.p[1] = current_points[1]; |
| - points_to_add.p[2] = current_points[2]; |
| - points_to_add.p[3] = current_points[3]; |
| - break; |
| - } |
| - case SkPath::kClose_Verb: { // iter.next returns 1 point (the last point) |
| - paths->push_back(CubicPath()); |
| - current_path = &paths->back(); |
| - continue; |
| - } |
| - default: { |
| - current_path = NULL; |
| - // Will return false. |
| - break; |
| - } |
| - } |
| - SkASSERT(current_path); |
| - if (!current_path) { |
| - paths->clear(); |
| - return false; |
| - } |
| - current_path->push_back(points_to_add); |
| - } |
| - return true; |
| -} |
| - |
| -bool LoadPathToDC(HDC context, const SkPath& path) { |
| - switch (path.getFillType()) { |
| - case SkPath::kWinding_FillType: { |
| - int res = SetPolyFillMode(context, WINDING); |
| - SkASSERT(res != 0); |
| - break; |
| - } |
| - case SkPath::kEvenOdd_FillType: { |
| - int res = SetPolyFillMode(context, ALTERNATE); |
| - SkASSERT(res != 0); |
| - break; |
| - } |
| - default: { |
| - SkASSERT(false); |
| - break; |
| - } |
| - } |
| - BOOL res = BeginPath(context); |
| - if (!res) { |
| - return false; |
| - } |
| - |
| - CubicPaths paths; |
| - if (!SkPathToCubicPaths(&paths, path)) |
| - return false; |
| - |
| - std::vector<POINT> points; |
| - for (CubicPaths::const_iterator path(paths.begin()); path != paths.end(); |
| - ++path) { |
| - if (!path->size()) |
| - continue; |
| - points.resize(0); |
| - points.reserve(path->size() * 3 / 4 + 1); |
| - points.push_back(skia::SkPointToPOINT(path->front().p[0])); |
| - for (CubicPath::const_iterator point(path->begin()); point != path->end(); |
| - ++point) { |
| - // Never add point->p[0] |
| - points.push_back(skia::SkPointToPOINT(point->p[1])); |
| - points.push_back(skia::SkPointToPOINT(point->p[2])); |
| - points.push_back(skia::SkPointToPOINT(point->p[3])); |
| - } |
| - SkASSERT((points.size() - 1) % 3 == 0); |
| - // This is slightly inefficient since all straight line and quadratic lines |
| - // are "upgraded" to a cubic line. |
| - // TODO(maruel): http://b/1147346 We should use |
| - // PolyDraw/PolyBezier/Polyline whenever possible. |
| - res = PolyBezier(context, &points.front(), |
| - static_cast<DWORD>(points.size())); |
| - SkASSERT(res != 0); |
| - if (res == 0) |
| - break; |
| - } |
| - if (res == 0) { |
| - // Make sure the path is discarded. |
| - AbortPath(context); |
| - } else { |
| - res = EndPath(context); |
| - SkASSERT(res != 0); |
| - } |
| - return true; |
| -} |
| - |
| void LoadTransformToDC(HDC dc, const SkMatrix& matrix) { |
| XFORM xf; |
| xf.eM11 = matrix[SkMatrix::kMScaleX]; |
| @@ -205,19 +77,7 @@ void LoadClippingRegionToDC(HDC context, |
| // to the region. |
| hrgn = CreateRectRgnIndirect(&skia::SkIRectToRECT(region.getBounds())); |
| } else { |
| - // It is complex. |
| - SkPath path; |
| - region.getBoundaryPath(&path); |
| - // Clip. Note that windows clipping regions are not affected by the |
| - // transform so apply it manually. |
| - // Since the transform is given as the original translation of canvas, we |
| - // should apply it in reverse. |
| - SkMatrix t(transformation); |
| - t.setTranslateX(-t.getTranslateX()); |
| - t.setTranslateY(-t.getTranslateY()); |
| - path.transform(t); |
| - LoadPathToDC(context, path); |
| - hrgn = PathToRegion(context); |
| + SkASSERT(!"Region clipping is being deprecated; this shouldn't fire."); |
|
reed1
2016/05/09 20:56:38
perhaps repeat the above assignment to hrgn (using
|
| } |
| int result = SelectClipRgn(context, hrgn); |
| SkASSERT(result != ERROR); |