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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 1167 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
1168 if (kOpaque_SkAlphaType != info.alphaType()) | 1168 if (kOpaque_SkAlphaType != info.alphaType()) |
1169 paint.setAlpha(0x80); // signal to m_trackedRegion that we are not f
ully opaque | 1169 paint.setAlpha(0x80); // signal to m_trackedRegion that we are not f
ully opaque |
1170 | 1170 |
1171 m_trackedRegion.didDrawRect(this, rect, paint, 0); | 1171 m_trackedRegion.didDrawRect(this, rect, paint, 0); |
1172 // more efficient would be to call markRectAsOpaque or MarkRectAsNonOpaq
ue directly, | 1172 // more efficient would be to call markRectAsOpaque or MarkRectAsNonOpaq
ue directly, |
1173 // rather than cons-ing up a paint with an xfermode and alpha | 1173 // rather than cons-ing up a paint with an xfermode and alpha |
1174 } | 1174 } |
1175 } | 1175 } |
1176 | 1176 |
1177 void GraphicsContext::writePixels(const SkBitmap& bitmap, int x, int y) | |
1178 { | |
1179 if (contextDisabled()) | |
1180 return; | |
1181 | |
1182 if (!bitmap.getTexture()) { | |
1183 SkAutoLockPixels alp(bitmap); | |
1184 if (bitmap.getPixels()) | |
1185 writePixels(bitmap.info(), bitmap.getPixels(), bitmap.rowBytes(), x,
y); | |
1186 } | |
1187 } | |
1188 | |
1189 void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
top, const SkPaint* paint) | 1177 void GraphicsContext::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar
top, const SkPaint* paint) |
1190 { | 1178 { |
1191 ASSERT(m_canvas); | 1179 ASSERT(m_canvas); |
1192 // Textures are bound to the blink main-thread GrContext, which can not be | 1180 // Textures are bound to the blink main-thread GrContext, which can not be |
1193 // used on the compositor raster thread. | 1181 // used on the compositor raster thread. |
1194 // FIXME: Mailbox support would make this possible in the GPU-raster case. | 1182 // FIXME: Mailbox support would make this possible in the GPU-raster case. |
1195 ASSERT(!isRecording() || !bitmap.getTexture()); | 1183 ASSERT(!isRecording() || !bitmap.getTexture()); |
1196 if (contextDisabled()) | 1184 if (contextDisabled()) |
1197 return; | 1185 return; |
1198 | 1186 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag | 1972 // FIXME: This is to not break tests (it results in the filter bitmap fl
ag |
1985 // being set to true). We need to decide if we respect InterpolationNone | 1973 // being set to true). We need to decide if we respect InterpolationNone |
1986 // being returned from computeInterpolationQuality. | 1974 // being returned from computeInterpolationQuality. |
1987 resampling = InterpolationLow; | 1975 resampling = InterpolationLow; |
1988 } | 1976 } |
1989 resampling = limitInterpolationQuality(this, resampling); | 1977 resampling = limitInterpolationQuality(this, resampling); |
1990 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); | 1978 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); |
1991 } | 1979 } |
1992 | 1980 |
1993 } // namespace blink | 1981 } // namespace blink |
OLD | NEW |