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

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

Issue 2386033002: Scale focus outline thickness with zoom level. (Closed)
Patch Set: merge conflicts Created 4 years, 2 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, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2008-2009 Torch Mobile, Inc. 3 * Copyright (C) 2008-2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 DrawLooperBuilder::ShadowAlphaMode = 300 DrawLooperBuilder::ShadowAlphaMode =
301 DrawLooperBuilder::ShadowRespectsAlpha, 301 DrawLooperBuilder::ShadowRespectsAlpha,
302 ShadowMode = DrawShadowAndForeground); 302 ShadowMode = DrawShadowAndForeground);
303 303
304 // It is assumed that this draw looper is used only for shadows 304 // It is assumed that this draw looper is used only for shadows
305 // (i.e. a draw looper is set if and only if there is a shadow). 305 // (i.e. a draw looper is set if and only if there is a shadow).
306 // The builder passed into this method will be destroyed. 306 // The builder passed into this method will be destroyed.
307 void setDrawLooper(std::unique_ptr<DrawLooperBuilder>); 307 void setDrawLooper(std::unique_ptr<DrawLooperBuilder>);
308 308
309 void drawFocusRing(const Vector<IntRect>&, 309 void drawFocusRing(const Vector<IntRect>&,
310 int width, 310 float width,
311 int offset, 311 int offset,
312 const Color&); 312 const Color&);
313 void drawFocusRing(const Path&, int width, int offset, const Color&); 313 void drawFocusRing(const Path&, float width, int offset, const Color&);
314 314
315 enum Edge { 315 enum Edge {
316 NoEdge = 0, 316 NoEdge = 0,
317 TopEdge = 1 << 1, 317 TopEdge = 1 << 1,
318 RightEdge = 1 << 2, 318 RightEdge = 1 << 2,
319 BottomEdge = 1 << 3, 319 BottomEdge = 1 << 3,
320 LeftEdge = 1 << 4 320 LeftEdge = 1 << 4
321 }; 321 };
322 typedef unsigned Edges; 322 typedef unsigned Edges;
323 void drawInnerShadow(const FloatRoundedRect&, 323 void drawInnerShadow(const FloatRoundedRect&,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 356
357 static void adjustLineToPixelBoundaries(FloatPoint& p1, 357 static void adjustLineToPixelBoundaries(FloatPoint& p1,
358 FloatPoint& p2, 358 FloatPoint& p2,
359 float strokeWidth, 359 float strokeWidth,
360 StrokeStyle); 360 StrokeStyle);
361 361
362 static int focusRingOutsetExtent(int offset, int width) { 362 static int focusRingOutsetExtent(int offset, int width) {
363 // Unlike normal outlines (whole width is outside of the offset), focus 363 // Unlike normal outlines (whole width is outside of the offset), focus
364 // rings are drawn with the center of the path aligned with the offset, so 364 // rings are drawn with the center of the path aligned with the offset, so
365 // only half of the width is outside of the offset. 365 // only half of the width is outside of the offset.
366 return focusRingOffset(offset) + (focusRingWidth(width) + 1) / 2; 366 return focusRingOffset(offset) + (width + 1) / 2;
367 } 367 }
368 368
369 #if OS(MACOSX)
370 static int focusRingWidth(int width) { return width; }
371 #else
372 static int focusRingWidth(int width) { return 1; }
373 #endif
374
375 #if DCHECK_IS_ON() 369 #if DCHECK_IS_ON()
376 void setInDrawingRecorder(bool); 370 void setInDrawingRecorder(bool);
377 #endif 371 #endif
378 372
379 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter); 373 static sk_sp<SkColorFilter> WebCoreColorFilterToSkiaColorFilter(ColorFilter);
380 374
381 private: 375 private:
382 const GraphicsContextState* immutableState() const { return m_paintState; } 376 const GraphicsContextState* immutableState() const { return m_paintState; }
383 377
384 GraphicsContextState* mutableState() { 378 GraphicsContextState* mutableState() {
(...skipping 12 matching lines...) Expand all
397 static SkPMColor antiColors1(int); 391 static SkPMColor antiColors1(int);
398 static SkPMColor antiColors2(int); 392 static SkPMColor antiColors2(int);
399 static void draw1xMarker(SkBitmap*, int); 393 static void draw1xMarker(SkBitmap*, int);
400 static void draw2xMarker(SkBitmap*, int); 394 static void draw2xMarker(SkBitmap*, int);
401 #endif 395 #endif
402 396
403 void saveLayer(const SkRect* bounds, const SkPaint*); 397 void saveLayer(const SkRect* bounds, const SkPaint*);
404 void restoreLayer(); 398 void restoreLayer();
405 399
406 // Helpers for drawing a focus ring (drawFocusRing) 400 // Helpers for drawing a focus ring (drawFocusRing)
407 void drawFocusRingPath(const SkPath&, const Color&, int width); 401 void drawFocusRingPath(const SkPath&, const Color&, float width);
408 void drawFocusRingRect(const SkRect&, const Color&, int width); 402 void drawFocusRingRect(const SkRect&, const Color&, float width);
409 403
410 // SkCanvas wrappers. 404 // SkCanvas wrappers.
411 void clipRRect(const SkRRect&, 405 void clipRRect(const SkRRect&,
412 AntiAliasingMode = NotAntiAliased, 406 AntiAliasingMode = NotAntiAliased,
413 SkRegion::Op = SkRegion::kIntersect_Op); 407 SkRegion::Op = SkRegion::kIntersect_Op);
414 void concat(const SkMatrix&); 408 void concat(const SkMatrix&);
415 409
416 // Apply deferred paint state saves 410 // Apply deferred paint state saves
417 void realizePaintSave() { 411 void realizePaintSave() {
418 if (contextDisabled()) 412 if (contextDisabled())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 463
470 float m_deviceScaleFactor; 464 float m_deviceScaleFactor;
471 465
472 unsigned m_printing : 1; 466 unsigned m_printing : 1;
473 unsigned m_hasMetaData : 1; 467 unsigned m_hasMetaData : 1;
474 }; 468 };
475 469
476 } // namespace blink 470 } // namespace blink
477 471
478 #endif // GraphicsContext_h 472 #endif // GraphicsContext_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698