void PaintAggregator::invalidateScrollRect() { IntRect scrollRect = m_update.scrollRect; m_update.scrollRect = IntRect(); m_update.scrollDelta = IntPoint(); invalidateRect(scrollRect); }
static BOOL onWM_COMMAND(uiControl *c, HWND hwnd, WORD code, LRESULT *lResult) { uiColorButton *b = uiColorButton(c); HWND parent; struct colorDialogRGBA rgba; if (code != BN_CLICKED) return FALSE; parent = GetAncestor(b->hwnd, GA_ROOT); // TODO didn't we have a function for this rgba.r = b->r; rgba.g = b->g; rgba.b = b->b; rgba.a = b->a; if (showColorDialog(parent, &rgba)) { b->r = rgba.r; b->g = rgba.g; b->b = rgba.b; b->a = rgba.a; invalidateRect(b->hwnd, NULL, TRUE); (*(b->onChanged))(b, b->onChangedData); } *lResult = 0; return TRUE; }
void FramelessScrollView::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect) { // Add in our offset within the ScrollView. IntRect dirtyRect = rect; dirtyRect.move(scrollbar->x(), scrollbar->y()); invalidateRect(dirtyRect); }
static void scrollto(uiArea *a, int which, struct scrollParams *p, intmax_t pos) { SCROLLINFO si; // note that the pos < 0 check is /after/ the p->length - p->pagesize check // it used to be /before/; this was actually a bug in Raymond Chen's original algorithm: if there are fewer than a page's worth of items, p->length - p->pagesize will be negative and our content draw at the bottom of the window // this SHOULD have the same effect with that bug fixed and no others introduced... (thanks to devin on irc.badnik.net for confirming this logic) if (pos > p->length - p->pagesize) pos = p->length - p->pagesize; if (pos < 0) pos = 0; // Direct2D doesn't have a method for scrolling the existing contents of a render target. // We'll have to just invalidate everything and hope for the best. invalidateRect(a->hwnd, NULL, FALSE); *(p->pos) = pos; // now commit our new scrollbar setup... ZeroMemory(&si, sizeof (SCROLLINFO)); si.cbSize = sizeof (SCROLLINFO); si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE; si.nPage = p->pagesize; si.nMin = 0; si.nMax = p->length - 1; // endpoint inclusive si.nPos = *(p->pos); SetScrollInfo(a->hwnd, which, &si, TRUE); }
void onAnimationTimer() { // The background changes each time we call drawBackground // so just call it whenever the animation time goes off. drawBackground(mTexture); invalidateRect(); }
bool DTViewSymbol::leftBttnDbl( int x, int y, WMouseKeyFlags ) //------------------------------------------------------------ { int prev = _descPaint->current(); if( _descPaint->select( x, y ) ) { if( prev != _descPaint->current() ) { if( prev >= 0 ) { invalidateRect( _descPaint->partRect( prev ) ); } invalidateRect( _descPaint->partRect( _descPaint->current() ) ); } _descPaint->enterHit(); return TRUE; } return FALSE; }
void TiledLayerChromium::setNeedsDisplayRect(const FloatRect& dirtyRect) { FloatRect scaledDirtyRect(dirtyRect); scaledDirtyRect.scale(contentsScale()); IntRect dirty = enclosingIntRect(scaledDirtyRect); invalidateRect(dirty); LayerChromium::setNeedsDisplayRect(dirtyRect); }
void uiColorButtonSetColor(uiColorButton *b, double r, double g, double bl, double a) { b->r = r; b->g = g; b->b = bl; b->a = a; invalidateRect(b->hwnd, NULL, TRUE); }
void Draw::dirtiedRect(SurfaceDescPtr surface, int16 left, int16 top, int16 right, int16 bottom) { if (surface == _backSurface) invalidateRect(left, top, right, bottom); else if (surface == _frontSurface) _vm->_video->dirtyRectsAdd(left, top, right, bottom); }
int OSDockWnd::onMouseMove(int x, int y) { OSDOCKWND_PARENT::onMouseMove(x, y); POINT pt={x,y}; if (m_snap_bdown) { if (PtInRect(&m_snapbtn, pt)) { if (!m_snap_inarea) { m_snap_inarea = 1; invalidateRect(&m_snapbtn); UpdateWindow(gethWnd()); } } else { if (m_snap_inarea) { m_snap_inarea = 0; invalidateRect(&m_snapbtn); UpdateWindow(gethWnd()); } } } return 1; }
int OSDockWnd::onLeftButtonDown(int x, int y) { OSDOCKWND_PARENT::onLeftButtonDown(x, y); POINT pt={x,y}; if (PtInRect(&m_snapbtn, pt)) { m_snap_bdown = 1; m_snap_inarea = 1; beginCapture(); invalidateRect(&m_snapbtn); UpdateWindow(gethWnd()); } return 1; }
static void onRsnSetInfo( HWND hwnd, const RS_INFO *pInfo ) { setLower ( hwnd, pInfo->_lower ); setUpper ( hwnd, pInfo->_upper ); setSaveStart2 ( hwnd, pInfo->_lower ); setSaveEnd2 ( hwnd, pInfo->_upper ); setStart ( hwnd, pInfo->_start ); setEnd ( hwnd, pInfo->_end ); setMinRange ( hwnd, pInfo->_minRange ); setGranularity( hwnd, pInfo->_granularity ); invalidateRect( hwnd ); invalidateCursor(); }
void FullColorBrushTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) { m_brushPos = m_mousePos = pos; Viewer *viewer = getViewer(); if (!viewer) return; TRasterImageP ri = (TRasterImageP)getImage(true); if (!ri) ri = (TRasterImageP)touchImage(); if (!ri) return; TRasterP ras = ri->getRaster(); TDimension dim = ras->getSize(); if (!(m_workRaster && m_backUpRas)) setWorkAndBackupImages(); m_workRaster->lock(); double maxThick = m_thickness.getValue().second; double thickness = m_pressure.getValue() ? computeThickness(e.m_pressure, m_thickness) : maxThick; double opacity = (m_pressure.getValue() ? computeThickness(e.m_pressure, m_opacity) : m_opacity.getValue().second) * 0.01; TPointD rasCenter = TPointD(dim.lx * 0.5, dim.ly * 0.5); TThickPoint point(pos + rasCenter, thickness); TPointD halfThick(maxThick * 0.5, maxThick * 0.5); TRectD invalidateRect(pos - halfThick, pos + halfThick); m_points.clear(); m_points.push_back(point); m_tileSet = new TTileSetFullColor(ras->getSize()); m_tileSaver = new TTileSaverFullColor(ras, m_tileSet); double hardness = m_hardness.getValue() * 0.01; m_brush = new BluredBrush(m_workRaster, maxThick, m_brushPad, hardness == 1.0); m_strokeRect = m_brush->getBoundFromPoints(m_points); updateWorkAndBackupRasters(m_strokeRect); m_tileSaver->save(m_strokeRect); m_brush->addPoint(point, opacity); m_brush->updateDrawing(ras, m_backUpRas, m_currentColor, m_strokeRect, m_opacity.getValue().second * 0.01); m_oldOpacity = opacity; m_lastRect = m_strokeRect; invalidate(invalidateRect.enlarge(2)); }
void ScrollView::adjustOverlappingScrollbarCount(int overlapDelta) { int oldCount = m_data->m_scrollbarsAvoidingResizer; m_data->m_scrollbarsAvoidingResizer += overlapDelta; if (parent() && parent()->isFrameView()) static_cast<FrameView*>(parent())->adjustOverlappingScrollbarCount(overlapDelta); else if (!m_data->m_scrollbarsSuppressed) { // If we went from n to 0 or from 0 to n and we're the outermost view, // we need to invalidate the windowResizerRect(), since it will now need to paint // differently. if (oldCount > 0 && m_data->m_scrollbarsAvoidingResizer == 0 || oldCount == 0 && m_data->m_scrollbarsAvoidingResizer > 0) invalidateRect(windowResizerRect()); } }
void TiledLayerChromium::updateBounds() { IntSize oldBounds = m_tiler->bounds(); IntSize newBounds = contentBounds(); if (oldBounds == newBounds) return; m_tiler->setBounds(newBounds); // Invalidate any areas that the new bounds exposes. Region oldRegion(IntRect(IntPoint(), oldBounds)); Region newRegion(IntRect(IntPoint(), newBounds)); newRegion.subtract(oldRegion); Vector<IntRect> rects = newRegion.rects(); for (size_t i = 0; i < rects.size(); ++i) invalidateRect(rects[i]); }
void PaintAggregator::invalidateRect(const IntRect& rect) { // Combine overlapping paints using smallest bounding box. for (size_t i = 0; i < m_update.paintRects.size(); ++i) { const IntRect& existingRect = m_update.paintRects[i]; if (existingRect.contains(rect)) // Optimize out redundancy. return; if (rect.intersects(existingRect) || sharesEdge(rect, existingRect)) { // Re-invalidate in case the union intersects other paint rects. IntRect combinedRect = unionRect(existingRect, rect); m_update.paintRects.remove(i); invalidateRect(combinedRect); return; } } // Add a non-overlapping paint. m_update.paintRects.append(rect); // If the new paint overlaps with a scroll, then it forces an invalidation of // the scroll. If the new paint is contained by a scroll, then trim off the // scroll damage to avoid redundant painting. if (!m_update.scrollRect.isEmpty()) { if (shouldInvalidateScrollRect(rect)) invalidateScrollRect(); else if (m_update.scrollRect.contains(rect)) { m_update.paintRects[m_update.paintRects.size() - 1] = subtractIntersection(rect, m_update.calculateScrollDamage()); if (m_update.paintRects[m_update.paintRects.size() - 1].isEmpty()) m_update.paintRects.remove(m_update.paintRects.size() - 1); } } if (m_update.paintRects.size() > maxPaintRects) combinePaintRects(); // Track how large the paintRects vector grows during an invalidation // sequence. Note: A subsequent invalidation may end up being combined // with all existing paints, which means that tracking the size of // paintRects at the time when popPendingUpdate() is called may mask // certain performance problems. Platform::current()->histogramCustomCounts("MPArch.RW_IntermediatePaintRectCount", m_update.paintRects.size(), 1, 100, 50); }
void Scrollbar::invalidatePart(ScrollbarPart part) { if (part == NoPart) return; IntRect result; IntRect beforeThumbRect, thumbRect, afterThumbRect; splitTrack(trackRect(), beforeThumbRect, thumbRect, afterThumbRect); if (part == BackTrackPart) result = beforeThumbRect; else if (part == ForwardTrackPart) result = afterThumbRect; else result = thumbRect; result.moveBy(-location()); invalidateRect(result); }
void ContentLayerChromium::paintContentsIfDirty() { ASSERT(drawsContent()); updateTileSizeAndTilingOption(); const IntRect& layerRect = visibleLayerRect(); if (layerRect.isEmpty()) return; IntRect dirty = enclosingIntRect(m_dirtyRect); dirty.intersect(IntRect(IntPoint(), contentBounds())); invalidateRect(dirty); if (!drawsContent()) return; prepareToUpdate(layerRect); resetNeedsDisplay(); }
static void scroll( HWND hwnd, int direction, int timeOut ) { LONG page_size = getEnd( hwnd ) - getStart( hwnd ); if ( page_size <= getGranularity( hwnd ) ) { page_size = getGranularity( hwnd ); } if ( page_size <= 0 ) { page_size = 1; } LONG delta = 0; if ( -1 == direction ) { delta = -page_size; if ( getStart( hwnd ) + delta < getLower( hwnd ) ) { delta = getLower( hwnd ) - getStart( hwnd ); } } else { delta = page_size; if ( getUpper( hwnd ) < getEnd( hwnd ) + delta ) { delta = getUpper( hwnd ) - getEnd( hwnd ); } } int start = adjust( hwnd, getStart( hwnd ) + delta ); int end = adjust( hwnd, getEnd ( hwnd ) + delta ); if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) { setStart( hwnd, start ); setEnd ( hwnd, end ); invalidateRect( hwnd ); invalidateCursor(); notifyParent( hwnd ); } // TODO: discuss SPI_GETKEYBOARDDELAY if ( 0 < timeOut ) { SetTimer( hwnd, 1, timeOut, 0 ); } }
void Widget::invalidate() { invalidateRect(IntRect(0, 0, width(), height())); }
static void onSize( HWND hwnd, UINT state, int cx, int cy ) { invalidateRect( hwnd ); }
static void onEnable( HWND hwnd, BOOL fEnable ) { invalidateRect( hwnd ); }
static void onSetKillFocus( HWND hwnd, HWND hwnUnused ) { invalidateRect( hwnd ); }
static void onKey( HWND hwnd, UINT vk, BOOL fDown, int cRepeat, UINT flags ) { long start = getStart( hwnd ); long end = getEnd( hwnd ); const BOOL controlKey = GetAsyncKeyState( VK_CONTROL ) < 0; if ( VK_ESCAPE == vk ) { if ( htNone != getHTCode( hwnd ) ) { setHTCode( hwnd, htNone ); const LONG oldStart = getSaveStart( hwnd ); const LONG oldEnd = getSaveEnd ( hwnd ); setStart( hwnd, oldStart ); setEnd ( hwnd, oldEnd ); invalidateRect( hwnd ); //onLButtonUp( hwnd, 0, 0, 0 ); // TODO retain capture anyway? // TODO notify parent return; //** FUNCTION EXIT POINT } } const UINT left_key = isVertical( hwnd ) ? VK_UP : VK_LEFT ; const UINT right_key = isVertical( hwnd ) ? VK_DOWN : VK_RIGHT; long granularity = getGranularity( hwnd ); if ( granularity <= 0 ) { granularity = 1; } if ( left_key == vk ) { if ( controlKey ) { if ( getMinRange( hwnd ) < end - start ) { end -= granularity; } } else if ( getLower( hwnd ) < start ) { start -= granularity; end -= granularity; } } else if ( right_key == vk ) { if ( end < getUpper( hwnd ) ) { end += granularity; if ( !controlKey ) { start += granularity; } } } else if ( VK_PRIOR == vk ) { scroll( hwnd, -1, 0 ); return; //*** FUNCTION EXIT POINT } else if ( VK_NEXT == vk ) { scroll( hwnd, 1, 0 ); return; //*** FUNCTION EXIT POINT } else if ( VK_HOME == vk ) { const long range = abs( getLower( hwnd ) - start ); start -= range; end -= range; } else if ( VK_END == vk ) { const long range = abs( getUpper( hwnd ) - end ); start += range; end += range; } start = adjust( hwnd, start ); end = adjust( hwnd, end ); if ( start != getStart( hwnd ) || end != getEnd( hwnd ) ) { setStart( hwnd, start ); setEnd ( hwnd, end ); invalidateRect( hwnd ); invalidateCursor(); notifyParent( hwnd ); } }
void Widget::paint(GraphicsContext*,const IntRect& r) { invalidateRect(r); if (PlatformWidget widget = platformWidget()) widget->Update(); }
void CCScrollbarLayerImpl::CCScrollbar::invalidate() { invalidateRect(frameRect()); }
void onAnimationTimer() { invalidateRect(); }
static void queueRedrawSampleText(struct fontDialog *f) { // TODO TRUE? invalidateRect(f->sampleBox, NULL, TRUE); }
void OSToolBarWnd::invalidateIcon(OSToolBarEntry *entry) { RECT r = entry->getLastRect(); invalidateRect(&r); cascadeRepaintRect(&r); }
static bool pluginInvoke(NPObject* header, NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* result) { PluginObject* plugin = reinterpret_cast<PluginObject*>(header); if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD]) return testCallback(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_CALLBACK_METHOD_RETURN]) return testCallbackReturn(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GETURL]) return getURL(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_DOM_ACCESS]) return testDOMAccess(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_URL_NOTIFY]) return getURLNotify(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_INVOKE_DEFAULT]) return testInvokeDefault(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_ENUMERATE]) return testEnumerate(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_DESTROY_STREAM]) return destroyStream(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GETINTIDENTIFIER]) return testGetIntIdentifier(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_EVALUATE]) return testEvaluate(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY]) return testGetProperty(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_GET_PROPERTY_RETURN_VALUE]) return testGetPropertyReturnValue(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_HAS_PROPERTY]) return testHasProperty(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_HAS_METHOD]) return testHasMethod(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_STRING]) return testIdentifierToString(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_IDENTIFIER_TO_INT]) return testIdentifierToInt(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_PASS_TEST_OBJECT]) return testPassTestObject(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_POSTURL_FILE]) return testPostURLFile(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_CONSTRUCT]) return testConstruct(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_SCRIPT_OBJECT_INVOKE]) return testScriptObjectInvoke(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_THROW_EXCEPTION_METHOD]) { browser->setexception(header, "plugin object testThrowException SUCCESS"); return true; } if (name == pluginMethodIdentifiers[ID_TEST_FAIL_METHOD]) { NPObject* windowScriptObject; browser->getvalue(plugin->npp, NPNVWindowNPObject, &windowScriptObject); browser->invoke(plugin->npp, windowScriptObject, name, args, argCount, result); return false; } if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) { NPObject* new_object = browser->createobject(plugin->npp, &pluginClass); assert(new_object->referenceCount == 1); OBJECT_TO_NPVARIANT(new_object, *result); return true; } if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) { NPObject* testObject = browser->createobject(plugin->npp, getTestClass()); assert(testObject->referenceCount == 1); OBJECT_TO_NPVARIANT(testObject, *result); return true; } if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) return destroyNullStream(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) { browser->reloadplugins(false); return true; } if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_AND_PAGES]) { browser->reloadplugins(true); return true; } if (name == pluginMethodIdentifiers[ID_TEST_GET_BROWSER_PROPERTY]) { browser->getproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), result); return true; } if (name == pluginMethodIdentifiers[ID_TEST_SET_BROWSER_PROPERTY]) { browser->setproperty(plugin->npp, NPVARIANT_TO_OBJECT(args[0]), stringVariantToIdentifier(args[1]), &args[2]); return true; } if (name == pluginMethodIdentifiers[ID_REMEMBER]) { if (plugin->rememberedObject) browser->releaseobject(plugin->rememberedObject); plugin->rememberedObject = NPVARIANT_TO_OBJECT(args[0]); browser->retainobject(plugin->rememberedObject); VOID_TO_NPVARIANT(*result); return true; } if (name == pluginMethodIdentifiers[ID_GET_REMEMBERED_OBJECT]) { assert(plugin->rememberedObject); browser->retainobject(plugin->rememberedObject); OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result); return true; } if (name == pluginMethodIdentifiers[ID_GET_AND_FORGET_REMEMBERED_OBJECT]) { assert(plugin->rememberedObject); OBJECT_TO_NPVARIANT(plugin->rememberedObject, *result); plugin->rememberedObject = 0; return true; } if (name == pluginMethodIdentifiers[ID_REF_COUNT]) { uint32_t refCount = NPVARIANT_TO_OBJECT(args[0])->referenceCount; INT32_TO_NPVARIANT(refCount, *result); return true; } if (name == pluginMethodIdentifiers[ID_SET_STATUS]) return testSetStatus(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_RESIZE_TO]) return testResizeTo(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_NORMALIZE]) return normalizeOverride(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_INVALIDATE_RECT]) return invalidateRect(plugin, args, argCount, result); if (name == pluginMethodIdentifiers[ID_OBJECTS_ARE_SAME]) return objectsAreSame(plugin, args, argCount, result); return false; }