Changeset 117190 in webkit


Ignore:
Timestamp:
May 15, 2012 4:58:55 PM (12 years ago)
Author:
jamesr@google.com
Message:

[chromium] Chromium port never sets USE(CG) so code behind it is dead
https://bugs.webkit.org/show_bug.cgi?id=86537

Reviewed by Adrienne Walker.

Deletes code behind USE(CG) in chromium-specific code and removes unneeded USE(SKIA) guards.

Source/WebCore:

  • platform/chromium/DragImageRef.h:

(WebCore):

  • platform/chromium/MIMETypeRegistryChromium.cpp:

(WebCore::MIMETypeRegistry::isSupportedImageMIMETypeForEncoding):

  • platform/chromium/ScrollbarThemeChromiumMac.mm:

(WebCore::ScrollbarThemeChromiumMac::paint):

  • platform/chromium/ThemeChromiumMac.mm:

(WebCore::paintStepper):

  • platform/graphics/chromium/PlatformImage.cpp:

(WebCore::PlatformImage::updateFromImage):

Source/WebKit/chromium:

  • src/GraphicsContext3DChromium.cpp:

(WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
(WebCore::GraphicsContext3DPrivate::grContext):
(WebCore::GraphicsContext3DPrivate::paintFramebufferToCanvas):
(WebCore::GraphicsContext3D::grContext):

  • src/GraphicsContext3DPrivate.h:

(GraphicsContext3DPrivate):

  • src/PlatformSupport.cpp:
  • src/WebViewImpl.cpp:

(WebKit::WebViewImpl::doPixelReadbackToCanvas):

Tools:

  • DumpRenderTree/chromium/WebViewHost.cpp:

(WebViewHost::paintRect):

Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117187 r117190  
     12012-05-15  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Chromium port never sets USE(CG) so code behind it is dead
     4        https://bugs.webkit.org/show_bug.cgi?id=86537
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Deletes code behind USE(CG) in chromium-specific code and removes unneeded USE(SKIA) guards.
     9
     10        * platform/chromium/DragImageRef.h:
     11        (WebCore):
     12        * platform/chromium/MIMETypeRegistryChromium.cpp:
     13        (WebCore::MIMETypeRegistry::isSupportedImageMIMETypeForEncoding):
     14        * platform/chromium/ScrollbarThemeChromiumMac.mm:
     15        (WebCore::ScrollbarThemeChromiumMac::paint):
     16        * platform/chromium/ThemeChromiumMac.mm:
     17        (WebCore::paintStepper):
     18        * platform/graphics/chromium/PlatformImage.cpp:
     19        (WebCore::PlatformImage::updateFromImage):
     20
    1212012-05-15  Keyar Hood  <keyar@chromium.org>
    222
  • trunk/Source/WebCore/platform/chromium/DragImageRef.h

    r95901 r117190  
    3030#define DragImageRef_h
    3131
    32 #if USE(CG)
    33 typedef struct CGImage* CGImageRef;
    34 #else
    3532class SkBitmap;
    36 #endif
    3733
    3834namespace WebCore {
    3935
    40 #if USE(CG)
    41 typedef CGImageRef DragImageRef;
    42 #else
    4336typedef SkBitmap* DragImageRef;
    44 #endif
    4537
    4638} // namespace WebCore
  • trunk/Source/WebCore/platform/chromium/MIMETypeRegistryChromium.cpp

    r114641 r117190  
    105105    if (mimeType == "image/jpeg" || mimeType == "image/png")
    106106        return true;
    107 #if USE(WEBP) && USE(SKIA)
     107#if USE(WEBP)
    108108    if (mimeType == "image/webp")
    109109        return true;
  • trunk/Source/WebCore/platform/chromium/ScrollbarThemeChromiumMac.mm

    r114088 r117190  
    3333#include "LocalCurrentGraphicsContext.h"
    3434#include "NSScrollerImpDetails.h"
     35#include "PlatformContextSkia.h"
    3536#include "PlatformSupport.h"
    3637#include "ScrollAnimatorMac.h"
    3738#include "ScrollView.h"
     39#include "skia/ext/skia_utils_mac.h"
    3840#include <Carbon/Carbon.h>
    39 
    40 #if USE(SKIA)
    41 #include "PlatformContextSkia.h"
    42 #include "skia/ext/skia_utils_mac.h"
    43 #endif
    4441
    4542namespace WebCore {
     
    122119        }
    123120
    124 #if !USE(SKIA)
    125         setIsCurrentlyDrawingIntoLayer(context->isCALayerContext());
    126 #else
    127121        setIsCurrentlyDrawingIntoLayer(false);
    128 #endif
    129122
    130123        CGFloat oldKnobAlpha = 0;
     
    202195    trackInfo.trackInfo.scrollbar.pressState = scrollbarPartToHIPressedState(scrollbar->pressedPart());
    203196
    204 #if USE(SKIA)
    205197    SkCanvas* canvas = context->platformContext()->canvas();
    206198    CGAffineTransform currentCTM = gfx::SkMatrixToCGAffineTransform(canvas->getTotalMatrix());
    207 #else
    208     CGAffineTransform currentCTM = CGContextGetCTM(context->platformContext());
    209 #endif
    210199
    211200    // The Aqua scrollbar is buggy when rotated and scaled.  We will just draw into a bitmap if we detect a scale or rotation.
     
    228217
    229218    // Draw thumbless.
    230 #if USE(SKIA)
    231219    gfx::SkiaBitLocker bitLocker(drawingContext->platformContext()->canvas());
    232220    CGContextRef cgContext = bitLocker.cgContext();
    233 #else
    234     CGContextRef cgContext = drawingContext->platformContext();
    235 #endif
    236221    HIThemeDrawTrack(&trackInfo, 0, cgContext, kHIThemeOrientationNormal);
    237222
  • trunk/Source/WebCore/platform/chromium/ThemeChromiumMac.mm

    r113532 r117190  
    3434#import "WebCoreSystemInterface.h"
    3535#import <Carbon/Carbon.h>
    36 #include <wtf/StdLibExtras.h>
    3736#import <objc/runtime.h>
    38 
    39 #if USE(SKIA)
    4037#include "PlatformContextSkia.h"
    4138#include "skia/ext/skia_utils_mac.h"
    42 #endif
     39#include <wtf/StdLibExtras.h>
    4340
    4441using namespace std;
     
    642639        backgroundBounds.origin.y = bounds.origin.y + (heightDiff / 2) + 1;
    643640    }
    644 #if USE(SKIA)
    645641    gfx::SkiaBitLocker bitLocker(context->platformContext()->canvas());
    646642    CGContextRef cgContext = bitLocker.cgContext();
    647 #else
    648     CGContextRef cgContext = context->platformContext();
    649 #endif
    650643    HIThemeDrawButton(&backgroundBounds, &drawInfo, cgContext, kHIThemeOrientationNormal, 0);
    651644    context->restore();
  • trunk/Source/WebCore/platform/graphics/chromium/PlatformImage.cpp

    r95901 r117190  
    2525
    2626#include "config.h"
    27 
    2827#include "PlatformImage.h"
    2928
    30 #if USE(SKIA)
    3129#include "NativeImageSkia.h"
    3230#include "PlatformContextSkia.h"
    33 #elif USE(CG)
    34 #include <CoreGraphics/CGBitmapContext.h>
    35 #include <CoreGraphics/CGContext.h>
    36 #include <CoreGraphics/CGImage.h>
    37 #include <wtf/RetainPtr.h>
    38 #else
    39 #error "Need to implement for your platform"
    40 #endif
    4131
    4232namespace WebCore {
     
    4838void PlatformImage::updateFromImage(NativeImagePtr nativeImage)
    4939{
    50 #if USE(SKIA)
    5140    // The layer contains an Image.
    5241    NativeImageSkia* skiaImage = static_cast<NativeImageSkia*>(nativeImage);
     
    5544
    5645    IntSize bitmapSize(skiaBitmap.width(), skiaBitmap.height());
    57 #elif USE(CG)
    58     // NativeImagePtr is a CGImageRef on Mac OS X.
    59     int width = CGImageGetWidth(nativeImage);
    60     int height = CGImageGetHeight(nativeImage);
    61     IntSize bitmapSize(width, height);
    62 #endif
    6346
    6447    size_t bufferSize = bitmapSize.width() * bitmapSize.height() * 4;
     
    6952    }
    7053
    71 #if USE(SKIA)
    7254    SkAutoLockPixels lock(skiaBitmap);
    7355    // FIXME: do we need to support more image configurations?
    7456    ASSERT(skiaBitmap.config()== SkBitmap::kARGB_8888_Config);
    7557    skiaBitmap.copyPixelsTo(m_pixelData.get(), bufferSize);
    76 #elif USE(CG)
    77     // FIXME: we should get rid of this temporary copy where possible.
    78     int tempRowBytes = width * 4;
    79     // Note we do not zero this vector since we are going to
    80     // completely overwrite its contents with the image below.
    81     // Try to reuse the color space from the image to preserve its colors.
    82     // Some images use a color space (such as indexed) unsupported by the bitmap context.
    83     RetainPtr<CGColorSpaceRef> colorSpaceReleaser;
    84     CGColorSpaceRef colorSpace = CGImageGetColorSpace(nativeImage);
    85     CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace);
    86     switch (colorSpaceModel) {
    87     case kCGColorSpaceModelMonochrome:
    88     case kCGColorSpaceModelRGB:
    89     case kCGColorSpaceModelCMYK:
    90     case kCGColorSpaceModelLab:
    91     case kCGColorSpaceModelDeviceN:
    92         break;
    93     default:
    94         colorSpaceReleaser.adoptCF(CGColorSpaceCreateDeviceRGB());
    95         colorSpace = colorSpaceReleaser.get();
    96         break;
    97     }
    98     RetainPtr<CGContextRef> tempContext(AdoptCF, CGBitmapContextCreate(m_pixelData.get(),
    99                                                                        width, height, 8, tempRowBytes,
    100                                                                        colorSpace,
    101                                                                        kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
    102     CGContextSetBlendMode(tempContext.get(), kCGBlendModeCopy);
    103     CGContextDrawImage(tempContext.get(),
    104                        CGRectMake(0, 0, static_cast<CGFloat>(width), static_cast<CGFloat>(height)),
    105                        nativeImage);
    106 #else
    107 #error "Need to implement for your platform."
    108 #endif
    10958}
    11059
  • trunk/Source/WebKit/chromium/ChangeLog

    r117177 r117190  
     12012-05-15  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Chromium port never sets USE(CG) so code behind it is dead
     4        https://bugs.webkit.org/show_bug.cgi?id=86537
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Deletes code behind USE(CG) in chromium-specific code and removes unneeded USE(SKIA) guards.
     9
     10        * src/GraphicsContext3DChromium.cpp:
     11        (WebCore::GraphicsContext3DPrivate::GraphicsContext3DPrivate):
     12        (WebCore::GraphicsContext3DPrivate::~GraphicsContext3DPrivate):
     13        (WebCore::GraphicsContext3DPrivate::grContext):
     14        (WebCore::GraphicsContext3DPrivate::paintFramebufferToCanvas):
     15        (WebCore::GraphicsContext3D::grContext):
     16        * src/GraphicsContext3DPrivate.h:
     17        (GraphicsContext3DPrivate):
     18        * src/PlatformSupport.cpp:
     19        * src/WebViewImpl.cpp:
     20        (WebKit::WebViewImpl::doPixelReadbackToCanvas):
     21
    1222012-05-15  Anders Carlsson  <andersca@apple.com>
    223
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r117166 r117190  
    4141#include "DrawingBuffer.h"
    4242#include "Extensions3DChromium.h"
     43#include "GrContext.h"
     44#include "GrGLInterface.h"
    4345#include "GraphicsContext3DPrivate.h"
    4446#include "HTMLCanvasElement.h"
     
    5355#include <wtf/text/CString.h>
    5456
    55 #if USE(CG)
    56 #include "GraphicsContext.h"
    57 #include "WebGLRenderingContext.h"
    58 #include <CoreGraphics/CGContext.h>
    59 #include <CoreGraphics/CGImage.h>
    60 #endif
    61 
    62 #if USE(SKIA)
    63 #include "GrContext.h"
    64 #include "GrGLInterface.h"
    65 #endif
    6657
    6758namespace {
     
    9889    , m_preserveDrawingBuffer(preserveDrawingBuffer)
    9990    , m_resourceSafety(ResourceSafetyUnknown)
    100 #if USE(SKIA)
    10191    , m_grContext(0)
    102 #elif USE(CG)
    103     , m_renderOutputSize(0)
    104 #else
    105 #error Must port to your platform
    106 #endif
    10792{
    10893}
     
    11095GraphicsContext3DPrivate::~GraphicsContext3DPrivate()
    11196{
    112 #if USE(SKIA)
    11397    if (m_grContext) {
    11498        m_grContext->contextDestroyed();
    11599        GrSafeUnref(m_grContext);
    116100    }
    117 #endif
    118101}
    119102
     
    164147}
    165148
    166 #if USE(SKIA)
    167149class GrMemoryAllocationChangedCallback : public Extensions3DChromium::GpuMemoryAllocationChangedCallbackCHROMIUM {
    168150public:
     
    203185    return m_grContext;
    204186}
    205 #endif
    206187
    207188void GraphicsContext3DPrivate::prepareTexture()
     
    229210    unsigned char* pixels = 0;
    230211    size_t bufferSize = 4 * width * height;
    231 #if USE(SKIA)
     212
    232213    const SkBitmap* canvasBitmap = imageBuffer->context()->platformContext()->bitmap();
    233214    const SkBitmap* readbackBitmap = 0;
     
    255236    SkAutoLockPixels bitmapLock(*readbackBitmap);
    256237    pixels = static_cast<unsigned char*>(readbackBitmap->getPixels());
    257 #elif USE(CG)
    258     if (!m_renderOutput || m_renderOutputSize != bufferSize) {
    259         m_renderOutput = adoptArrayPtr(new unsigned char[bufferSize]);
    260         m_renderOutputSize = bufferSize;
    261     }
    262 
    263     pixels = m_renderOutput.get();
    264 #else
    265 #error Must port to your platform
    266 #endif
    267238
    268239    m_impl->readBackFramebuffer(pixels, 4 * width * height, framebuffer, width, height);
     
    276247    }
    277248
    278 #if USE(SKIA)
    279249    readbackBitmap->notifyPixelsChanged();
    280250    if (m_resizingBitmap.readyToDraw()) {
     
    285255        canvas.drawBitmapRect(m_resizingBitmap, 0, dst);
    286256    }
    287 #elif USE(CG)
    288     GraphicsContext3D::paintToCanvas(pixels, width, height, imageBuffer->width(), imageBuffer->height(), imageBuffer->context()->platformContext());
    289 #else
    290 #error Must port to your platform
    291 #endif
    292257}
    293258
     
    10581023}
    10591024
    1060 #if USE(SKIA)
    10611025GrContext* GraphicsContext3D::grContext()
    10621026{
    10631027    return m_private->grContext();
    10641028}
    1065 #endif
    10661029
    10671030void GraphicsContext3D::prepareTexture()
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DPrivate.h

    r117110 r117190  
    2929#include "Extensions3DChromium.h"
    3030#include "GraphicsContext3D.h"
     31#include "SkBitmap.h"
    3132#include <wtf/HashSet.h>
    3233#include <wtf/OwnArrayPtr.h>
    3334#include <wtf/OwnPtr.h>
    34 #if USE(SKIA)
    35 #include "SkBitmap.h"
    36 #endif
    37 
    38 #if USE(SKIA)
     35
    3936class GrContext;
    40 #endif
    4137
    4238namespace WebKit {
     
    6965    PlatformGraphicsContext3D platformGraphicsContext3D() const;
    7066    Platform3DObject platformTexture() const;
    71 #if USE(SKIA)
    7267    GrContext* grContext();
    73 #endif
    7468
    7569    bool makeContextCurrent();
     
    325319    GraphicsContext3DPrivate(PassOwnPtr<WebKit::WebGraphicsContext3D>, bool preserveDrawingBuffer);
    326320
     321    void initializeExtensions();
     322
    327323    OwnPtr<WebKit::WebGraphicsContext3D> m_impl;
    328324    OwnPtr<Extensions3DChromium> m_extensions;
     
    344340    ResourceSafety m_resourceSafety;
    345341
    346 #if USE(SKIA)
    347342    // If the width and height of the Canvas's backing store don't
    348343    // match those that we were given in the most recent call to
     
    353348
    354349    GrContext* m_grContext;
    355 #endif
    356 
    357 #if USE(CG)
    358     OwnArrayPtr<unsigned char> m_renderOutput;
    359     size_t m_renderOutputSize;
    360 #endif
    361 
    362     void initializeExtensions();
    363350};
    364351
  • trunk/Source/WebKit/chromium/src/PlatformSupport.cpp

    r116840 r117190  
    6161#include "platform/WebURL.h"
    6262#include "platform/WebVector.h"
    63 
    64 #if USE(CG)
    65 #include <CoreGraphics/CGContext.h>
    66 #endif
    6763
    6864#if OS(WINDOWS)
  • trunk/Source/WebKit/chromium/src/WebViewImpl.cpp

    r117170 r117190  
    166166#endif
    167167
    168 #if USE(CG)
    169 #include <CoreGraphics/CGBitmapContext.h>
    170 #include <CoreGraphics/CGContext.h>
    171 #endif
    172 
    173168#if OS(WINDOWS)
    174169#include "RenderThemeChromiumWin.h"
     
    14851480{
    14861481    ASSERT(!m_layerTreeView.isNull());
    1487 #if USE(SKIA)
     1482
    14881483    PlatformContextSkia context(canvas);
    14891484
     
    14911486    GraphicsContext gc(reinterpret_cast<PlatformGraphicsContext*>(&context));
    14921487    int bitmapHeight = canvas->getDevice()->accessBitmap(false).height();
    1493 #elif USE(CG)
    1494     GraphicsContext gc(canvas);
    1495     int bitmapHeight = CGBitmapContextGetHeight(reinterpret_cast<CGContextRef>(canvas));
    1496 #else
    1497     notImplemented();
    1498 #endif
     1488
    14991489    // Compute rect to sample from inverted GPU buffer.
    15001490    IntRect invertRect(rect.x(), bitmapHeight - rect.maxY(), rect.width(), rect.height());
  • trunk/Tools/ChangeLog

    r117186 r117190  
     12012-05-15  James Robinson  <jamesr@chromium.org>
     2
     3        [chromium] Chromium port never sets USE(CG) so code behind it is dead
     4        https://bugs.webkit.org/show_bug.cgi?id=86537
     5
     6        Reviewed by Adrienne Walker.
     7
     8        Deletes code behind USE(CG) in chromium-specific code and removes unneeded USE(SKIA) guards.
     9
     10        * DumpRenderTree/chromium/WebViewHost.cpp:
     11        (WebViewHost::paintRect):
     12
    1132012-05-15  James Robinson  <jamesr@chromium.org>
    214
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r117186 r117190  
    17361736    ASSERT(canvas());
    17371737    m_isPainting = true;
    1738 #if USE(CG)
    1739     webWidget()->paint(skia::BeginPlatformPaint(canvas()), rect);
    1740     skia::EndPlatformPaint(canvas());
    1741 #else
    17421738    webWidget()->paint(canvas(), rect);
    1743 #endif
    17441739    m_isPainting = false;
    17451740}
Note: See TracChangeset for help on using the changeset viewer.