OLD | NEW |
---|---|
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 #include <wtf/MathExtras.h> | 48 #include <wtf/MathExtras.h> |
49 | 49 |
50 #if OS(DARWIN) | 50 #if OS(DARWIN) |
51 #include <ApplicationServices/ApplicationServices.h> | 51 #include <ApplicationServices/ApplicationServices.h> |
52 #endif | 52 #endif |
53 | 53 |
54 using namespace std; | 54 using namespace std; |
55 | 55 |
56 namespace WebCore { | 56 namespace WebCore { |
57 | 57 |
58 GraphicsContext::GraphicsContext(PlatformGraphicsContext* platformGraphicsContex t) | 58 GraphicsContext::GraphicsContext(SkCanvas* canvas) |
59 : m_updatingControlTints(false) | 59 : m_updatingControlTints(false) |
60 , m_transparencyCount(0) | 60 , m_transparencyCount(0) |
61 { | 61 { |
62 if (platformGraphicsContext) | 62 m_data = new PlatformContextSkia(canvas); |
63 platformGraphicsContext->setGraphicsContext(this); | 63 m_data->setGraphicsContext(this); |
64 | 64 |
65 // the caller owns the gc | 65 // the caller owns the gc |
66 m_data = platformGraphicsContext; | 66 setPaintingDisabled(!canvas); |
67 setPaintingDisabled(!platformGraphicsContext || !platformGraphicsContext->ca nvas()); | |
68 } | 67 } |
69 | 68 |
70 GraphicsContext::~GraphicsContext() | 69 GraphicsContext::~GraphicsContext() |
71 { | 70 { |
72 ASSERT(m_stack.isEmpty()); | 71 ASSERT(m_stack.isEmpty()); |
73 ASSERT(!m_transparencyCount); | 72 ASSERT(!m_transparencyCount); |
73 delete m_data; | |
jamesr
2013/04/29 23:56:17
can you instead make m_data an OwnPtr<> since you'
| |
74 } | 74 } |
75 | 75 |
76 PlatformGraphicsContext* GraphicsContext::platformContext() const | 76 PlatformGraphicsContext* GraphicsContext::platformContext() const |
77 { | 77 { |
78 ASSERT(!paintingDisabled()); | 78 ASSERT(!paintingDisabled()); |
79 return m_data; | 79 return m_data; |
80 } | 80 } |
81 | 81 |
82 bool GraphicsContext::isAcceleratedContext() const | 82 bool GraphicsContext::isAcceleratedContext() const |
83 { | 83 { |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1758 static const SkPMColor colors[] = { | 1758 static const SkPMColor colors[] = { |
1759 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1759 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
1760 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1760 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
1761 }; | 1761 }; |
1762 | 1762 |
1763 return colors[index]; | 1763 return colors[index]; |
1764 } | 1764 } |
1765 #endif | 1765 #endif |
1766 | 1766 |
1767 } | 1767 } |
OLD | NEW |