Changeset 98406 in webkit
- Timestamp:
- Oct 25, 2011, 4:10:12 PM (15 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.exp.in (modified) (2 diffs)
-
WebCore/platform/graphics/GraphicsContext.cpp (modified) (1 diff)
-
WebCore/platform/graphics/GraphicsContext.h (modified) (2 diffs)
-
WebCore/platform/graphics/cg/GraphicsContextCG.cpp (modified) (2 diffs)
-
WebCore/platform/graphics/cg/ImageCG.cpp (modified) (1 diff)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (modified) (2 diffs)
-
WebKit2/WebProcess/WebPage/WebPage.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r98403 r98406 1 2011-10-25 Beth Dakin <bdakin@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=70852 4 Setting up a HiDPI base-level GraphicsContext should be more straightforward for 5 WebKit2 6 7 Reviewed by Dan Bernstein. 8 9 This patch removes the old cg-only GraphicsContext::setBaseCTM() api, and adds 10 platform-independent GraphicsContext::applyDeviceScaleFactor(). 11 * WebCore.exp.in: 12 * platform/graphics/GraphicsContext.cpp: 13 (WebCore::GraphicsContext::platformApplyDeviceScaleFactor): 14 (WebCore::GraphicsContext::applyDeviceScaleFactor): 15 * platform/graphics/GraphicsContext.h: 16 * platform/graphics/cg/GraphicsContextCG.cpp: 17 (WebCore::GraphicsContext::platformApplyDeviceScaleFactor): 18 19 Since this patch removes GraphicsContext::setBaseCTM(), this code has been 20 reverted to do what it used to do before that was added; it just calls into 21 WebCoreSystemInterface directly. 22 * platform/graphics/cg/ImageCG.cpp: 23 (WebCore::Image::drawPattern): 24 1 25 2011-10-25 Anders Carlsson <andersca@apple.com> 2 26 -
trunk/Source/WebCore/WebCore.exp.in
r98316 r98406 429 429 __ZN7WebCore15GraphicsContext20endTransparencyLayerEv 430 430 __ZN7WebCore15GraphicsContext21setCompositeOperationENS_17CompositeOperatorE 431 __ZN7WebCore15GraphicsContext22applyDeviceScaleFactorEf 431 432 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf 432 433 __ZN7WebCore15GraphicsContext28setImageInterpolationQualityENS_20InterpolationQualityE … … 1219 1220 __ZNK7WebCore14SecurityOrigin5equalEPKS0_ 1220 1221 __ZNK7WebCore15FocusController18focusedOrMainFrameEv 1221 __ZN7WebCore15GraphicsContext10setBaseCTMERKNS_15AffineTransformE1222 1222 __ZNK7WebCore15GraphicsContext15platformContextEv 1223 1223 __ZNK7WebCore15GraphicsContext16paintingDisabledEv -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r97487 r98406 765 765 } 766 766 767 } 767 #if !USE(CG) 768 void GraphicsContext::platformApplyDeviceScaleFactor() 769 { 770 } 771 #endif 772 773 void GraphicsContext::applyDeviceScaleFactor(float deviceScaleFactor) 774 { 775 scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); 776 platformApplyDeviceScaleFactor(); 777 } 778 779 } -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r97886 r98406 270 270 271 271 void setIsAcceleratedContext(bool); 272 273 void setBaseCTM(const AffineTransform&);274 272 #endif 275 273 bool isAcceleratedContext() const; … … 415 413 // for drawing into the buffer and then into this context. 416 414 PassOwnPtr<ImageBuffer> createCompatibleBuffer(const IntSize&) const; 415 416 // This function applies the device scale factor to the context, making the context capable of 417 // acting as a base-level context for a HiDPI environment. 418 void applyDeviceScaleFactor(float); 419 void platformApplyDeviceScaleFactor(); 417 420 418 421 #if OS(WINCE) && !PLATFORM(QT) -
trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
r97886 r98406 1471 1471 } 1472 1472 1473 void GraphicsContext::setBaseCTM(const AffineTransform& transform)1474 {1475 wkSetBaseCTM(platformContext(), transform);1476 }1477 1478 1473 void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags mode) 1479 1474 { … … 1598 1593 } 1599 1594 1600 } 1595 void GraphicsContext::platformApplyDeviceScaleFactor() 1596 { 1597 // CoreGraphics expects the base CTM of a HiDPI context to have the scale factor applied to it. 1598 // Failing to change the base level CTM will cause certain CG features, such as focus rings, 1599 // to draw with a scale factor of 1 rather than the actual scale factor. 1600 wkSetBaseCTM(platformContext(), getCTM()); 1601 } 1602 1603 } -
trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp
r97886 r98406 285 285 286 286 // FIXME: Really want a public API for this. It is just CGContextSetBaseCTM(context, CGAffineTransformIdentiy). 287 AffineTransform identity; 288 identity.makeIdentity(); 289 ctxt->setBaseCTM(identity); 287 wkSetBaseCTM(context, CGAffineTransformIdentity); 290 288 CGContextSetPatternPhase(context, CGSizeZero); 291 289 -
trunk/Source/WebKit2/ChangeLog
r98403 r98406 1 2011-10-25 Beth Dakin <bdakin@apple.com> 2 3 https://bugs.webkit.org/show_bug.cgi?id=70852 4 Setting up a HiDPI base-level GraphicsContext should be more straightforward for 5 WebKit2 6 7 Reviewed by Dan Bernstein. 8 9 When we need a base-level HiDPI GraphicsContext, call into new GraphicsContext api 10 GraphicsContext::applyDeviceScaleFactor() rather than manually scaling and 11 adjusting the base CTM. 12 * WebProcess/WebPage/DrawingAreaImpl.cpp: 13 (WebKit::DrawingAreaImpl::display): 14 * WebProcess/WebPage/WebPage.cpp: 15 (WebKit::WebPage::snapshotInViewCoordinates): 16 (WebKit::WebPage::scaledSnapshotInDocumentCoordinates): 17 1 18 2011-10-25 Anders Carlsson <andersca@apple.com> 2 19 -
trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
r98113 r98406 647 647 648 648 IntSize bitmapSize = bounds.size(); 649 bitmapSize.scale(m_webPage->corePage()->deviceScaleFactor()); 649 float deviceScaleFactor = m_webPage->corePage()->deviceScaleFactor(); 650 bitmapSize.scale(deviceScaleFactor); 650 651 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(bitmapSize, ShareableBitmap::SupportsAlpha); 651 652 if (!bitmap) … … 670 671 671 672 OwnPtr<GraphicsContext> graphicsContext = createGraphicsContext(bitmap.get()); 672 graphicsContext->scale(FloatSize(m_webPage->corePage()->deviceScaleFactor(), m_webPage->corePage()->deviceScaleFactor())); 673 #if USE(CG) 674 graphicsContext->setBaseCTM(graphicsContext->getCTM()); 675 #endif 673 graphicsContext->applyDeviceScaleFactor(deviceScaleFactor); 676 674 677 675 updateInfo.updateRectBounds = bounds; -
trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp
r98403 r98406 944 944 945 945 OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); 946 graphicsContext->scale(FloatSize(deviceScaleFactor, deviceScaleFactor)); 947 #if USE(CG) 948 graphicsContext->setBaseCTM(graphicsContext->getCTM()); 949 #endif 946 graphicsContext->applyDeviceScaleFactor(deviceScaleFactor); 950 947 graphicsContext->translate(-rect.x(), -rect.y()); 951 948 … … 973 970 974 971 OwnPtr<WebCore::GraphicsContext> graphicsContext = snapshot->bitmap()->createGraphicsContext(); 975 graphicsContext->scale(FloatSize(combinedScaleFactor, combinedScaleFactor)); 976 #if USE(CG) 977 graphicsContext->setBaseCTM(graphicsContext->getCTM()); 978 #endif 972 graphicsContext->applyDeviceScaleFactor(combinedScaleFactor); 979 973 graphicsContext->translate(-rect.x(), -rect.y()); 980 974
Note:
See TracChangeset
for help on using the changeset viewer.