Lines Matching defs:bitmap
82 const SkBitmap& bitmap,
88 *texture = this->set(device, bitmap, params);
98 const SkBitmap& bitmap,
105 GrTexture* result = (GrTexture*)bitmap.getTexture();
108 fTexture = GrLockAndRefCachedBitmapTexture(device->context(), bitmap, params);
132 * to make conservative guesses when we return an "equivalent" bitmap.
135 SkBitmap bitmap;
136 bitmap.setInfo(renderTarget->info());
137 return bitmap;
293 // need to bump our genID for compatibility with clients that "know" we have a bitmap
862 static int determine_tile_size(const SkBitmap& bitmap, const SkIRect& src, int maxTileSize) {
880 // Given a bitmap, an optional src rect, and a context with a clip and matrix determine what
881 // pixels from the bitmap are necessary.
883 const SkBitmap& bitmap,
904 SkIRect bmpBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
910 bool SkGpuDevice::shouldTileBitmap(const SkBitmap& bitmap,
916 // if bitmap is explictly texture backed then just use the texture
917 if (NULL != bitmap.getTexture()) {
922 if (bitmap.width() > maxTileSize || bitmap.height() > maxTileSize) {
923 determine_clipped_src_rect(fContext, bitmap, srcRectPtr, clippedSrcRect);
924 *tileSize = determine_tile_size(bitmap, *clippedSrcRect, maxTileSize);
928 if (bitmap.width() * bitmap.height() < 4 * kBmpSmallTileSize * kBmpSmallTileSize) {
933 if (GrIsBitmapInCache(fContext, bitmap, ¶ms)) {
937 // At this point we know we could do the draw by uploading the entire bitmap
942 // assumption here is that sw bitmap size is a good proxy for its size as
944 bitmap.getSize();
952 determine_clipped_src_rect(fContext, bitmap, srcRectPtr, clippedSrcRect);
953 *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
961 const SkBitmap& bitmap,
970 this->drawBitmapCommon(*draw, bitmap, NULL, NULL, paint, SkCanvas::kNone_DrawBitmapRectFlag);
1047 static bool needs_texture_domain(const SkBitmap& bitmap,
1056 needsTextureDomain = srcRect.width() < bitmap.width() ||
1057 srcRect.height() < bitmap.height();
1075 const SkBitmap& bitmap,
1084 // If there is no src rect, or the src rect contains the entire bitmap then we're effectively
1087 SkScalar w = SkIntToScalar(bitmap.width());
1088 SkScalar h = SkIntToScalar(bitmap.height());
1098 srcRect.fRight >= bitmap.width() && srcRect.fBottom >= bitmap.height()) {
1104 // Convert the bitmap to a shader so that the rect can be drawn
1106 SkBitmap tmp; // subset of bitmap, if necessary
1107 const SkBitmap* bitmapPtr = &bitmap;
1113 // In bleed mode we position and trim the bitmap based on the src rect which is
1115 // the desired portion of the bitmap and then update 'm' and 'srcRect' to
1124 if (!bitmap.extractSubset(&tmp, iSrc)) {
1202 if (this->shouldTileBitmap(bitmap, params, srcRectPtr, maxTileSize, &tileSize,
1204 this->drawTiledBitmap(bitmap, srcRect, clippedSrcRect, params, paint, flags, tileSize,
1208 bool needsTextureDomain = needs_texture_domain(bitmap,
1213 this->internalDrawBitmap(bitmap,
1223 // Break 'bitmap' into several tiles to draw it since it has already
1225 void SkGpuDevice::drawTiledBitmap(const SkBitmap& bitmap,
1235 // at each tile in cases where 'bitmap' holds an SkDiscardablePixelRef that
1237 SkAutoLockPixels alp(bitmap);
1240 int nx = bitmap.width() / tileSize;
1241 int ny = bitmap.height() / tileSize;
1275 // but stay within the bitmap bounds
1276 iClampRect = SkIRect::MakeWH(bitmap.width(), bitmap.height());
1287 if (bitmap.extractSubset(&tmpB, iTileR)) {
1288 // now offset it to make it "local" to our tmp bitmap
1291 bool needsTextureDomain = needs_texture_domain(bitmap,
1313 * internalDrawBitmap assumes that the specified bitmap will fit in a texture
1316 void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
1323 SkASSERT(bitmap
1324 bitmap.height() <= fContext->getMaxTextureSize());
1327 SkAutoCachedTexture act(this, bitmap, ¶ms, &texture);
1378 // Construct a GrPaint by setting the bitmap texture as the first effect and then configuring
1382 bool alphaOnly = !(kAlpha_8_SkColorType == bitmap.colorType());
1407 void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
1412 SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
1413 if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
1417 int w = bitmap.width();
1418 int h = bitmap.height();
1422 SkAutoCachedTexture act(this, bitmap, NULL, &texture);
1425 // This bitmap will own the filtered result as a texture.
1432 SkIRect clipBounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
1465 void SkGpuDevice::drawBitmapRect(const SkDraw& origDraw, const SkBitmap& bitmap,
1473 SkIntToScalar(bitmap.width()),
1474 SkIntToScalar(bitmap.height()));
1485 // clip the tmpSrc to the bounds of the bitmap. No check needed if src==null.
1508 this->drawBitmapCommon(*draw, bitmap, &tmpSrc, &dstSize, paint, flags);
1534 // This bitmap will own the filtered result as a texture.