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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/GraphicsContext.cpp

Issue 2768143002: Back PaintRecord with PaintOpBuffer instead of SkPicture (Closed)
Patch Set: More unit tests Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 1253
1254 m_canvas->scale(WebCoreFloatToSkScalar(x), WebCoreFloatToSkScalar(y)); 1254 m_canvas->scale(WebCoreFloatToSkScalar(x), WebCoreFloatToSkScalar(y));
1255 } 1255 }
1256 1256
1257 void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) { 1257 void GraphicsContext::setURLForRect(const KURL& link, const IntRect& destRect) {
1258 if (contextDisabled()) 1258 if (contextDisabled())
1259 return; 1259 return;
1260 DCHECK(m_canvas); 1260 DCHECK(m_canvas);
1261 1261
1262 sk_sp<SkData> url(SkData::MakeWithCString(link.getString().utf8().data())); 1262 sk_sp<SkData> url(SkData::MakeWithCString(link.getString().utf8().data()));
1263 PaintCanvasAnnotateRectWithURL(m_canvas, destRect, url.get()); 1263 m_canvas->Annotate(PaintCanvas::AnnotationType::URL, destRect,
1264 std::move(url));
1264 } 1265 }
1265 1266
1266 void GraphicsContext::setURLFragmentForRect(const String& destName, 1267 void GraphicsContext::setURLFragmentForRect(const String& destName,
1267 const IntRect& rect) { 1268 const IntRect& rect) {
1268 if (contextDisabled()) 1269 if (contextDisabled())
1269 return; 1270 return;
1270 DCHECK(m_canvas); 1271 DCHECK(m_canvas);
1271 1272
1272 sk_sp<SkData> skDestName(SkData::MakeWithCString(destName.utf8().data())); 1273 sk_sp<SkData> skDestName(SkData::MakeWithCString(destName.utf8().data()));
1273 PaintCanvasAnnotateLinkToDestination(m_canvas, rect, skDestName.get()); 1274 m_canvas->Annotate(PaintCanvas::AnnotationType::LINK_TO_DESTINATION, rect,
1275 std::move(skDestName));
1274 } 1276 }
1275 1277
1276 void GraphicsContext::setURLDestinationLocation(const String& name, 1278 void GraphicsContext::setURLDestinationLocation(const String& name,
1277 const IntPoint& location) { 1279 const IntPoint& location) {
1278 if (contextDisabled()) 1280 if (contextDisabled())
1279 return; 1281 return;
1280 DCHECK(m_canvas); 1282 DCHECK(m_canvas);
1281 1283
1284 SkRect rect = SkRect::MakeXYWH(location.x(), location.y(), 0, 0);
1282 sk_sp<SkData> skName(SkData::MakeWithCString(name.utf8().data())); 1285 sk_sp<SkData> skName(SkData::MakeWithCString(name.utf8().data()));
1283 PaintCanvasAnnotateNamedDestination( 1286 m_canvas->Annotate(PaintCanvas::AnnotationType::NAMED_DESTINATION, rect,
1284 m_canvas, SkPoint::Make(location.x(), location.y()), skName.get()); 1287 std::move(skName));
1285 } 1288 }
1286 1289
1287 void GraphicsContext::concatCTM(const AffineTransform& affine) { 1290 void GraphicsContext::concatCTM(const AffineTransform& affine) {
1288 concat(affineTransformToSkMatrix(affine)); 1291 concat(affineTransformToSkMatrix(affine));
1289 } 1292 }
1290 1293
1291 void GraphicsContext::fillRectWithRoundedHole( 1294 void GraphicsContext::fillRectWithRoundedHole(
1292 const FloatRect& rect, 1295 const FloatRect& rect,
1293 const FloatRoundedRect& roundedHoleRect, 1296 const FloatRoundedRect& roundedHoleRect,
1294 const Color& color) { 1297 const Color& color) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1347 break; 1350 break;
1348 default: 1351 default:
1349 NOTREACHED(); 1352 NOTREACHED();
1350 break; 1353 break;
1351 } 1354 }
1352 1355
1353 return nullptr; 1356 return nullptr;
1354 } 1357 }
1355 1358
1356 } // namespace blink 1359 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698